[FIX] sotck: correctly set reference on internal move
When creating a chained picking, the first move has no sequence, this is because there is no sequence for stock.picking.internal. Set the sequence before the chained move so that the sequences are in the right order. opw 621261
This commit is contained in:
parent
d246e36c82
commit
3f7d168130
|
@ -2061,17 +2061,20 @@ class stock_move(osv.osv):
|
|||
for todo in moves_by_type.values():
|
||||
ptype = todo[0][1][5] and todo[0][1][5] or location_obj.picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
|
||||
if picking:
|
||||
# Need to check name of old picking because it always considers picking as "OUT" when created from Sales Order
|
||||
old_ptype = location_obj.picking_type_get(cr, uid, picking.move_lines[0].location_id, picking.move_lines[0].location_dest_id)
|
||||
if old_ptype != picking.type:
|
||||
if old_ptype == 'internal':
|
||||
old_pick_name = seq_obj.get(cr, uid, 'stock.picking')
|
||||
else:
|
||||
old_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + old_ptype)
|
||||
self.pool.get('stock.picking').write(cr, uid, [picking.id], {'name': old_pick_name, 'type': old_ptype}, context=context)
|
||||
# name of new picking according to its type
|
||||
if ptype == 'internal':
|
||||
new_pick_name = seq_obj.get(cr, uid,'stock.picking')
|
||||
else :
|
||||
new_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + ptype)
|
||||
pickid = self._create_chained_picking(cr, uid, new_pick_name, picking, ptype, todo, context=context)
|
||||
# Need to check name of old picking because it always considers picking as "OUT" when created from Sales Order
|
||||
old_ptype = location_obj.picking_type_get(cr, uid, picking.move_lines[0].location_id, picking.move_lines[0].location_dest_id)
|
||||
if old_ptype != picking.type:
|
||||
old_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + old_ptype)
|
||||
self.pool.get('stock.picking').write(cr, uid, [picking.id], {'name': old_pick_name, 'type': old_ptype}, context=context)
|
||||
else:
|
||||
pickid = False
|
||||
for move, (loc, dummy, delay, dummy, company_id, ptype, invoice_state) in todo:
|
||||
|
|
Loading…
Reference in New Issue