From 7f1a6b95b9c0b20e479dfde3003c8605cb83e27b Mon Sep 17 00:00:00 2001 From: Alessio Renda Date: Wed, 27 Dec 2023 17:59:08 +0100 Subject: [PATCH] [FIX] mrp_bom_attribute_match: display proper BoM structure --- mrp_bom_attribute_match/models/mrp_bom.py | 12 ++++++++++++ .../reports/mrp_report_bom_structure.py | 3 --- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mrp_bom_attribute_match/models/mrp_bom.py b/mrp_bom_attribute_match/models/mrp_bom.py index 590dc1d59..ddec681b5 100644 --- a/mrp_bom_attribute_match/models/mrp_bom.py +++ b/mrp_bom_attribute_match/models/mrp_bom.py @@ -160,6 +160,18 @@ class MrpBomLine(models.Model): if self.bom_product_template_attribute_value_ids: self._check_variants_validity() + def _skip_bom_line(self, product): + # Make this method compatible to work with NewIds + res = super()._skip_bom_line(product) + + return res and ( + len( + set(product.product_template_attribute_value_ids.ids) + & set(self.bom_product_template_attribute_value_ids.ids) + ) + != len(self.bom_product_template_attribute_value_ids.attribute_id) + ) + class MrpBom(models.Model): _inherit = "mrp.bom" diff --git a/mrp_bom_attribute_match/reports/mrp_report_bom_structure.py b/mrp_bom_attribute_match/reports/mrp_report_bom_structure.py index 7861e86ec..b4b82c5dc 100644 --- a/mrp_bom_attribute_match/reports/mrp_report_bom_structure.py +++ b/mrp_bom_attribute_match/reports/mrp_report_bom_structure.py @@ -32,9 +32,6 @@ class ReportBomStructure(models.AbstractModel): if to_ignore_line_ids: for to_ignore_line_id in to_ignore_line_ids: bom.bom_line_ids = [(3, to_ignore_line_id, 0)] - product = bom._get_component_template_product( - line, product, line.product_id - ) components, total = super()._get_bom_lines( bom, bom_quantity, product, line_id, level )