summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Pinna Puissant <jpp@odoo.com>2019-06-25 08:42:27 +0000
committerJorge Pinna Puissant <jpp@odoo.com>2019-06-25 08:42:27 +0000
commit044c5c2c81d0b3dd8b4abb8df34f6b1cb0a6e122 (patch)
tree618c79cac145c4844c746f0ad03ebf93ac2ffa39
parentcb4afb263b50b2e7c6ecfc2a57bb3df0dfd0f881 (diff)
[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) <sig@openerp.com>
-rw-r--r--addons/mrp/report/mrp_report_bom_structure.py3
1 files changed, 1 insertions, 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')))