[FIX] stock: Only re-reserve moves not done or cancelled

`Recheck availability` must ignore
the done or cancelled moves.

Otherwise, it raises the warning telling you cannot
unreserve a done move.
856b31719c/addons/stock/stock.py (L1899)

To reproduce the issue:
 - Create a delivery order,
   with 10 stockable product A
   & 10 stockable product B,
   mark as todo.
 - Create a receipt,
   with 5 stockable product A,
   mark as todo & transfer.
 - Cancel the move of stockable product B from the delivery order,
   in Traceability -> Stock Moves.
 - Come back to the delivery order, `check availability`,
   then, `recheck availability`

Closes #9550
This commit is contained in:
Matthieu Dietrich 2015-11-13 10:07:25 +01:00 committed by Denis Ledoux
parent 856b31719c
commit 0d0bb69bb1
1 changed files with 2 additions and 1 deletions

View File

@ -1389,7 +1389,8 @@ class stock_picking(osv.osv):
This can be used to provide a button that rereserves taking into account the existing pack operations
"""
for pick in self.browse(cr, uid, ids, context=context):
self.rereserve_quants(cr, uid, pick, move_ids = [x.id for x in pick.move_lines], context=context)
self.rereserve_quants(cr, uid, pick, move_ids = [x.id for x in pick.move_lines
if x.state not in ('done', 'cancel')], context=context)
def rereserve_quants(self, cr, uid, picking, move_ids=[], context=None):
""" Unreserve quants then try to reassign quants."""