From d80d79efa3648b8c0a21acf980e1bb6efccad2b8 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Sat, 13 Feb 2021 11:33:47 +0000 Subject: [PATCH] [FIX] stock: Don't take into account canceled moves to check for backorder Do a transfer in two steps with several move lines (e.g.: Vendors => Input => Stock). In the first picking, set quantity = 0 on a single line. Transfer it and say 'No backorder'. In the second picking, set all quantities (you have two move lines confirmed and one canceled). Validate the transfer. The backorder wizard is launched. It should not. closes odoo/odoo#66680 X-original-commit: 79d834f2c2ec167831fe0986afb728207a467d67 Signed-off-by: Arnold Moyaux --- addons/stock/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index de240547f1a..0e719020041 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -986,7 +986,7 @@ class Picking(models.Model): for picking in self: quantity_todo = {} quantity_done = {} - for move in picking.mapped('move_lines'): + for move in picking.mapped('move_lines').filtered(lambda m: m.state != "cancel"): quantity_todo.setdefault(move.product_id.id, 0) quantity_done.setdefault(move.product_id.id, 0) quantity_todo[move.product_id.id] += move.product_uom._compute_quantity(move.product_uom_qty, move.product_id.uom_id, rounding_method='HALF-UP')