From 9713d66a15ea2447b6a9e476f450b6efb43243d4 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 12 Nov 2019 16:14:12 +0000 Subject: [PATCH] [FIX] stock: Returning canceled moves Steps to reproduce the bug: - Let's consider two storable products P1 and P2 from the same vendor V - P1 and P2 have the routes 'Buy' and 'Make to order' - Create a SO for 1 P1 and 1 P2 and confirm it - A delivery order DO has been created - A PO has been created for V, confirm it - Process the shipment, receive 1 P1 and 0 P2 with no backorder - Process DO with no backorder - Return DO by clicking on 'Return' button Bug: 1 P1 and 1 P2 were suggested to be returned but the movement for P2 had been canceled. Closes #39547 opw:2116582 closes odoo/odoo#40220 X-original-commit: bb94b6591fb148a4c1b94f9c28d2c10e44e12283 Signed-off-by: Simon Goffin (sig) --- addons/stock/wizard/stock_picking_return.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/stock/wizard/stock_picking_return.py b/addons/stock/wizard/stock_picking_return.py index d57b10efd48..8b39d2fa9ac 100644 --- a/addons/stock/wizard/stock_picking_return.py +++ b/addons/stock/wizard/stock_picking_return.py @@ -50,6 +50,8 @@ class ReturnPicking(models.TransientModel): if self.picking_id and self.picking_id.state != 'done': raise UserError(_("You may only return Done pickings.")) for move in self.picking_id.move_lines: + if move.state == 'cancel': + continue if move.scrapped: continue if move.move_dest_ids: