From d211ea5f7c93f91c4d90748894529f063d490bcb Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 10 Oct 2018 11:27:54 +0000 Subject: [PATCH] [FIX] purchase_mrp: Received Quantity in Purchase Order remains '0' Steps to reproduce the bug: - Create Product P: with BOM type - Kit and BOM components > Set - Invoicing: on delivered quantity - Create PO with P and confirm - shipment 1 will be generated - Cancel the PO - shipment 1 - will also get canceled - Reset the canceled PO to quotation and confirm it - new shipment 2 will be generated - Validate the shipment and receive product KIT Bug: Check PO - 'Received Qty' was not updated Inspired from: https://github.com/odoo/odoo/commit/c2dfdc3081764a492a94024f1fb57e15636b04c9 opw:1889303 closes odoo/odoo#27622 --- addons/purchase_mrp/models/purchase_mrp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/purchase_mrp/models/purchase_mrp.py b/addons/purchase_mrp/models/purchase_mrp.py index ded251bbdff..c24d50eb776 100644 --- a/addons/purchase_mrp/models/purchase_mrp.py +++ b/addons/purchase_mrp/models/purchase_mrp.py @@ -23,7 +23,8 @@ class PurchaseOrderLine(models.Model): # In the case of a kit, we need to check if all components are shipped. Since the BOM might # have changed, we don't compute the quantities but verify the move state. if bom: - bom_delivered = all([move.state == 'done' for move in self.move_ids]) + moves = self.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_qty else: