From 044c5c2c81d0b3dd8b4abb8df34f6b1cb0a6e122 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Tue, 25 Jun 2019 08:42:27 +0000 Subject: [PATCH] [FIX] mrp: BoM structure report with variants 1. Setup a few variants for a product; 2. Create a BoM for each of the variants with different components/quantities, make sure to specify the product variant field; 3. Go to any of the variants and click Print BoM Structure. Before this commit, it will print the BoM structure for all variants and not only the one selected. Also, it will print in all the variants the same BoM structure. If multiples BoM were selected to print, each variant of the product was printed with each of the BoM structure selected. Now, if you select one BoM, only this is printed. If multiples BoM are printed, each product, and product variant are correctly related to their respective BoM structure. opw-2007939 closes odoo/odoo#34353 Signed-off-by: Simon Goffin (sig) --- addons/mrp/report/mrp_report_bom_structure.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/mrp/report/mrp_report_bom_structure.py b/addons/mrp/report/mrp_report_bom_structure.py index 529b12e72a4..1a51b88933d 100644 --- a/addons/mrp/report/mrp_report_bom_structure.py +++ b/addons/mrp/report/mrp_report_bom_structure.py @@ -14,8 +14,7 @@ class ReportBomStructure(models.AbstractModel): docs = [] for bom_id in docids: bom = self.env['mrp.bom'].browse(bom_id) - variant = data and data.get('variant') - candidates = variant and self.env['product.product'].browse(variant) or bom.product_tmpl_id.product_variant_ids + candidates = bom.product_id or bom.product_tmpl_id.product_variant_ids for product_variant_id in candidates: if data and data.get('childs'): doc = self._get_pdf_line(bom_id, product_id=product_variant_id, qty=float(data.get('quantity')), child_bom_ids=json.loads(data.get('childs')))