[FIX] stock: don't propagate cancel when chained move is done
When you have e.g. an SO with a product MTO generating a manufacturing order, and you put the delivery order to done, before the MO is done, you can not cancel the MO anymore, because the cancel method checks if the move is not done (and raises an error). As the user stays blocked in this case, it is better to just not try to cancel the destination move by not propagating the cancel when the destination move is done. opw-786571
This commit is contained in:
@@ -2532,7 +2532,8 @@ class stock_move(osv.osv):
|
||||
else:
|
||||
if move.move_dest_id:
|
||||
if move.propagate:
|
||||
self.action_cancel(cr, uid, [move.move_dest_id.id], context=context)
|
||||
if move.move_dest_id.state not in ('done', 'cancel'):
|
||||
self.action_cancel(cr, uid, [move.move_dest_id.id], context=context)
|
||||
elif move.move_dest_id.state == 'waiting':
|
||||
#If waiting, the chain will be broken and we are not sure if we can still wait for it (=> could take from stock instead)
|
||||
self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'}, context=context)
|
||||
|
||||
Reference in New Issue
Block a user