From 2922b05ea200ae7d68dfde939d79003a038ba1eb Mon Sep 17 00:00:00 2001 From: "Touati Djamel (otd)" Date: Tue, 30 May 2023 14:04:01 +0000 Subject: [PATCH] [FIX] mrp: access BoM overview with dynamic variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: - Create an attribute with "Variant Creation Mode" = Dynamically - In a product template, add the attributes and some values - Create a new BoM for this product - Click on "Overview" smart button Problem: Traceback is triggered, because the `_match_all_variant_values` function is called but without the product, while it takes at least one: https://github.com/odoo/odoo/blob/7b7f65d5047731978d2d8bcbd8d77cfa86ac1d53/addons/mrp/models/mrp_routing.py#L95 https://github.com/odoo/odoo/blob/7b7f65d5047731978d2d8bcbd8d77cfa86ac1d53/addons/mrp/models/product.py#L209 As the variant creation mode is set to “dynamically”, we can skip the get of operation line. opw-3332902 opw-3329263 closes odoo/odoo#124015 X-original-commit: d8d312280aa041d5beee437c8192cb63050bfc40 Signed-off-by: William Henrotin (whe) Signed-off-by: Djamel Touati (otd) --- addons/mrp/report/mrp_report_bom_structure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/report/mrp_report_bom_structure.py b/addons/mrp/report/mrp_report_bom_structure.py index 374e4b3a16f..f2aec352530 100644 --- a/addons/mrp/report/mrp_report_bom_structure.py +++ b/addons/mrp/report/mrp_report_bom_structure.py @@ -353,7 +353,7 @@ class ReportBomStructure(models.AbstractModel): company = bom.company_id or self.env.company operation_index = 0 for operation in bom.operation_ids: - if operation._skip_operation_line(product): + if not product or operation._skip_operation_line(product): continue capacity = operation.workcenter_id._get_capacity(product) operation_cycle = float_round(qty / capacity, precision_rounding=1, rounding_method='UP')