From 8efface66a9f320d86589f78712ddd78072fa934 Mon Sep 17 00:00:00 2001 From: Ilyas Date: Mon, 23 Oct 2023 12:46:40 +0200 Subject: [PATCH] [IMP] mrp_bom_attribute_match: added demo data --- mrp_bom_attribute_match/__manifest__.py | 1 + .../demo/product_product_demo.xml | 197 ++++++++++++++++++ .../reports/mrp_report_bom_structure.py | 6 +- 3 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 mrp_bom_attribute_match/demo/product_product_demo.xml diff --git a/mrp_bom_attribute_match/__manifest__.py b/mrp_bom_attribute_match/__manifest__.py index 2b14def26..280cfde48 100644 --- a/mrp_bom_attribute_match/__manifest__.py +++ b/mrp_bom_attribute_match/__manifest__.py @@ -11,4 +11,5 @@ "data": [ "views/mrp_bom_views.xml", ], + "demo": ["demo/product_product_demo.xml"], } diff --git a/mrp_bom_attribute_match/demo/product_product_demo.xml b/mrp_bom_attribute_match/demo/product_product_demo.xml new file mode 100644 index 000000000..522972ce5 --- /dev/null +++ b/mrp_bom_attribute_match/demo/product_product_demo.xml @@ -0,0 +1,197 @@ + + + + + + + Top Level + product + + + + + + + + Sub Level + product + + + + + + + + Sub Sub + product + + + + + + + + Sub Sub 2 + product + + + + + + + + + attr1 + 10 + + + office + + 1 + + + gaming + + 1 + + + + attr2 + 10 + + + v1 + + 1 + + + v2 + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + 1 + + + + + + + + + + 1 + + + + + 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 463c0ed15..7861e86ec 100644 --- a/mrp_bom_attribute_match/reports/mrp_report_bom_structure.py +++ b/mrp_bom_attribute_match/reports/mrp_report_bom_structure.py @@ -32,7 +32,9 @@ 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) + product = bom._get_component_template_product( + line, product, line.product_id + ) components, total = super()._get_bom_lines( bom, bom_quantity, product, line_id, level ) @@ -74,6 +76,7 @@ class ReportBomStructure(models.AbstractModel): else: prod_qty = line.product_qty * factor / bom.product_qty company = bom.company_id or self.env.company + # Modification start if line.component_template_id: vals = product.product_template_attribute_value_ids.mapped( "product_attribute_value_id" @@ -98,6 +101,7 @@ class ReportBomStructure(models.AbstractModel): price += company.currency_id.round(not_rounded_price) else: continue + # Modification end else: not_rounded_price = ( line.product_id.uom_id._compute_price(