~unifield-team/unifield-wm/us-727

« back to all changes in this revision

Viewing changes to sale_override/sale.py

  • Committer: Quentin THEURET
  • Date: 2011-12-27 15:55:06 UTC
  • mto: (459.5.8 uf_637)
  • mto: This revision was merged to the branch mainline in revision 723.
  • Revision ID: qt@tempo-consulting.fr-20111227155506-dl53z1dfoec5v77z
UF-637 [IMP] Split order line on PO/SO/IR

Show diffs side-by-side

added added

removed removed

Lines of Context:
364
364
 
365
365
sale_order()
366
366
 
 
367
 
 
368
class sale_order_line(osv.osv):
 
369
    _name = 'sale.order.line'
 
370
    _inherit = 'sale.order.line'
 
371
 
 
372
    _columns = {
 
373
        'parent_line_id': fields.many2one('sale.order.line', string='Parent line'),
 
374
    }
 
375
 
 
376
    def open_split_wizard(self, cr, uid, ids, context={}):
 
377
        '''
 
378
        Open the wizard to split the line
 
379
        '''
 
380
        if not context:
 
381
            context = {}
 
382
 
 
383
        if isinstance(ids, (int, long)):
 
384
            ids = [ids]
 
385
 
 
386
        for line in self.browse(cr, uid, ids, context=context):
 
387
            data = {'sale_line_id': line.id, 'original_qty': line.product_uom_qty, 'old_line_qty': line.product_uom_qty}
 
388
            wiz_id = self.pool.get('split.sale.order.line.wizard').create(cr, uid, data, context=context)
 
389
            return {'type': 'ir.actions.act_window',
 
390
                    'res_model': 'split.sale.order.line.wizard',
 
391
                    'view_type': 'form',
 
392
                    'view_mode': 'form',
 
393
                    'target': 'new',
 
394
                    'res_id': wiz_id,
 
395
                    'context': context}
 
396
 
 
397
sale_order_line()
 
398
 
367
399
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: