From f1744a31a1fa3494345f9502bfd6cb5b8aa95ffa Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 4 Apr 2019 09:19:23 +0000 Subject: [PATCH] [FIX] stock: scrap and validate - Sell 4 units of a product in stock - On the picking, create a scrap for 1 unit - Validate - In the immediate transfer wizard, validate The scrap is reset to zero. This is because the wizard overwrite the done quantity with the reserved quantity (0.0). If the move is already done, there is no reason to overwrite the quantity. opw-1958514 closes odoo/odoo#32410 Signed-off-by: Nicolas Martinelli (nim) --- addons/stock/wizard/stock_immediate_transfer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/wizard/stock_immediate_transfer.py b/addons/stock/wizard/stock_immediate_transfer.py index 66a652ac795..9b46a91c585 100644 --- a/addons/stock/wizard/stock_immediate_transfer.py +++ b/addons/stock/wizard/stock_immediate_transfer.py @@ -22,7 +22,7 @@ class StockImmediateTransfer(models.TransientModel): picking.action_assign() if picking.state != 'assigned': raise UserError(_("Could not reserve all requested products. Please use the \'Mark as Todo\' button to handle the reservation manually.")) - for move in picking.move_lines: + for move in picking.move_lines.filtered(lambda m: m.state not in ['done', 'cancel']): for move_line in move.move_line_ids: move_line.qty_done = move_line.product_uom_qty if picking._check_backorder():