Skip to content

Commit

Permalink
[FIX] stock: don't propagate cancel when chained move is done
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jco-odoo committed Dec 13, 2017
1 parent 30d0861 commit 22f8660
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addons/stock/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2532,7 +2532,8 @@ def action_cancel(self, cr, uid, ids, context=None):
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)
Expand Down

0 comments on commit 22f8660

Please sign in to comment.