From 73b4abfcbcfd9bc1fd70e474a57d1f6d236e9bf8 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 2 Oct 2018 11:19:55 +0200 Subject: [PATCH] [FIX] sale_mrp: Updating delivered qty Steps to reproduce the bug: - Create three stockable products: Kit, C1 and C2 - Create a phantom BOM for Kit with C1 and C2 as components - Set the invoicing policy of the kit based on delivered qty - Create an SO for the kit and validate it - On the delivery order, just deliver C1 and create a backorder for C2 - Cancel the backorder and duplicate it - Deliver the duplicated backorder and validate it Bug: The delivered qty on the SO line has not been updated to 1. opw:1886315 --- addons/sale_mrp/sale_mrp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale_mrp/sale_mrp.py b/addons/sale_mrp/sale_mrp.py index 3ac4d375487..67374edb4e2 100644 --- a/addons/sale_mrp/sale_mrp.py +++ b/addons/sale_mrp/sale_mrp.py @@ -35,7 +35,8 @@ class SaleOrderLine(models.Model): # have changed, we don't compute the quantities but verify the move state. bom = self.env['mrp.bom']._bom_find(product=self.product_id) if bom and bom.type == 'phantom': - bom_delivered = all([move.state == 'done' for move in self.procurement_ids.mapped('move_ids')]) + moves = self.procurement_ids.mapped('move_ids').filtered(lambda m: m.picking_id and m.picking_id.state != 'cancel') + bom_delivered = all([move.state == 'done' for move in moves]) if bom_delivered: return self.product_uom_qty else: