From ee65157357542cb90f575388eb5cbdda3aae76d4 Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Thu, 13 Feb 2020 10:49:55 -0800 Subject: [PATCH] FIX `purchase_by_sale_history_mrp` When BOM builds specific product, add id not product to set. --- .../tests/test_purchase_by_sale_history.py | 1 + purchase_by_sale_history_mrp/wizard/purchase_by_sale_history.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/purchase_by_sale_history_mrp/tests/test_purchase_by_sale_history.py b/purchase_by_sale_history_mrp/tests/test_purchase_by_sale_history.py index 74e6a810..1a881af5 100644 --- a/purchase_by_sale_history_mrp/tests/test_purchase_by_sale_history.py +++ b/purchase_by_sale_history_mrp/tests/test_purchase_by_sale_history.py @@ -46,6 +46,7 @@ class MTestPurchaseBySaleHistoryMRP(test_purchase_by_sale_history.TestPurchaseBy product11_bom = self.env['mrp.bom'].create({ 'product_tmpl_id': product11.product_tmpl_id.id, + # 'product_id': product11.id, # To test specific product 'product_qty': 1.0, 'product_uom_id': product11.uom_id.id, 'bom_line_ids': [(0, 0, { diff --git a/purchase_by_sale_history_mrp/wizard/purchase_by_sale_history.py b/purchase_by_sale_history_mrp/wizard/purchase_by_sale_history.py index b6f877b5..b7f431eb 100644 --- a/purchase_by_sale_history_mrp/wizard/purchase_by_sale_history.py +++ b/purchase_by_sale_history_mrp/wizard/purchase_by_sale_history.py @@ -50,7 +50,7 @@ class PurchaseBySaleHistory(models.TransientModel): def bom_parent_product_ids_line(line): product_ids = set() if line.bom_id.product_id: - product_ids.add((line.bom_id.product_id, line.product_qty)) + product_ids.add((line.bom_id.product_id.id, line.product_qty)) else: for p in line.bom_id.product_tmpl_id.product_variant_ids: product_ids.add((p.id, line.product_qty))