From a961edeff5b352e9583265a38198fbc786e3bbbb Mon Sep 17 00:00:00 2001 From: JordiMForgeFlow Date: Wed, 7 Jul 2021 12:02:18 +0000 Subject: [PATCH] [FIX] sale_mrp: filter cancelled moves when computing dropship delivered qty The current behaviour implies that the quantity delivered will never be updated if there are related moves that have been cancelled. After the fix, when computing the quantity delivered, it will only consider the stock moves that are not cancelled. closes odoo/odoo#73573 X-original-commit: 6f6366888415c5e020ffee893a78cc7a3f6925f5 Signed-off-by: William Henrotin Signed-off-by: Arnold Moyaux --- addons/sale_mrp/models/sale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale_mrp/models/sale.py b/addons/sale_mrp/models/sale.py index b0d5733aa81..95e888302d4 100644 --- a/addons/sale_mrp/models/sale.py +++ b/addons/sale_mrp/models/sale.py @@ -86,7 +86,8 @@ class SaleOrderLine(models.Model): # the products for this PO will set the qty_delivered. We might need to check the # state of all PO as well... but sale_mrp doesn't depend on purchase. if dropship: - if order_line.move_ids and all(m.state == 'done' for m in order_line.move_ids): + moves = order_line.move_ids.filtered(lambda m: m.state != 'cancel') + if moves and all(m.state == 'done' for m in moves): order_line.qty_delivered = order_line.product_uom_qty else: order_line.qty_delivered = 0.0