From 0d0bb69bb1b4c286b9de224e6c4ab29b72b5f27c Mon Sep 17 00:00:00 2001 From: Matthieu Dietrich Date: Fri, 13 Nov 2015 10:07:25 +0100 Subject: [PATCH] [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. https://github.com/odoo/odoo/blob/856b31719c69e7f022143ce39df7c6c43688beb9/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 --- addons/stock/stock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 23c9fd610f1..2e372b7ae58 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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."""