[IMP] stock refactor _create_chained_picking
bzr revid: sebastien.beau@akretion.com.br-20111203115320-35jtptnnoyegqjcd
This commit is contained in:
+19
-14
@@ -1852,23 +1852,28 @@ class stock_move(osv.osv):
|
||||
result[m.picking_id].append( (m, dest) )
|
||||
return result
|
||||
|
||||
def _create_chained_picking(self, cr, uid, pick_name, picking, ptype, move, context=None):
|
||||
def _prepare_chained_picking(self, cr, uid, pick_name, picking, ptype, move, context=None):
|
||||
res_obj = self.pool.get('res.company')
|
||||
return {
|
||||
'name': pick_name,
|
||||
'origin': tools.ustr(picking.origin or ''),
|
||||
'type': ptype,
|
||||
'note': picking.note,
|
||||
'move_type': picking.move_type,
|
||||
'auto_picking': move[0][1][1] == 'auto',
|
||||
'stock_journal_id': move[0][1][3],
|
||||
'company_id': move[0][1][4] or res_obj._company_default_get(cr, uid, 'stock.company', context=context),
|
||||
'address_id': picking.address_id.id,
|
||||
'invoice_state': 'none',
|
||||
'date': picking.date,
|
||||
}
|
||||
|
||||
|
||||
def _create_chained_picking(self, cr, uid, pick_name, picking, ptype, move, context=None):
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
pick_id= picking_obj.create(cr, uid, {
|
||||
'name': pick_name,
|
||||
'origin': tools.ustr(picking.origin or ''),
|
||||
'type': ptype,
|
||||
'note': picking.note,
|
||||
'move_type': picking.move_type,
|
||||
'auto_picking': move[0][1][1] == 'auto',
|
||||
'stock_journal_id': move[0][1][3],
|
||||
'company_id': move[0][1][4] or res_obj._company_default_get(cr, uid, 'stock.company', context=context),
|
||||
'address_id': picking.address_id.id,
|
||||
'invoice_state': 'none',
|
||||
'date': picking.date,
|
||||
})
|
||||
pick_id= picking_obj.create(cr, uid, self._prepare_chained_picking(cr, uid, pick_name, picking, ptype, move, context=context))
|
||||
return pick_id
|
||||
|
||||
def create_chained_picking(self, cr, uid, moves, context=None):
|
||||
res_obj = self.pool.get('res.company')
|
||||
location_obj = self.pool.get('stock.location')
|
||||
|
||||
Reference in New Issue
Block a user