From 03c2083890d95d37d0e5f045bf04b8a77632e82c Mon Sep 17 00:00:00 2001 From: Kaushalya Mandaliya Date: Tue, 16 Jul 2019 08:33:52 +0000 Subject: [PATCH] [FIX] mrp: traceback while printing BOM structure report From the commit: 36b976cceeeb65fe44bf982f1c110747543d8d32 A traceback is generated while printing BOM structure report, which is fixed in this commit. task-2024247 closes: #34899 Signed-off-by: Simon Lejeune (sle) --- addons/mrp/report/mrp_report_bom_structure.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/mrp/report/mrp_report_bom_structure.py b/addons/mrp/report/mrp_report_bom_structure.py index 7488594e48e..3dca86873d5 100644 --- a/addons/mrp/report/mrp_report_bom_structure.py +++ b/addons/mrp/report/mrp_report_bom_structure.py @@ -15,19 +15,20 @@ class ReportBomStructure(models.AbstractModel): for bom_id in docids: bom = self.env['mrp.bom'].browse(bom_id) candidates = bom.product_id or bom.product_tmpl_id.product_variant_ids + quantity = float(data.get('quantity', 1)) 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'))) + doc = self._get_pdf_line(bom_id, product_id=product_variant_id, qty=quantity, child_bom_ids=json.loads(data.get('childs'))) else: - doc = self._get_pdf_line(bom_id, product_id=product_variant_id, qty=float(data.get('quantity')), unfolded=True) + doc = self._get_pdf_line(bom_id, product_id=product_variant_id, qty=quantity, unfolded=True) doc['report_type'] = 'pdf' doc['report_structure'] = data and data.get('report_type') or 'all' docs.append(doc) if not candidates: if data and data.get('childs'): - doc = self._get_pdf_line(bom_id, qty=float(data.get('quantity')), child_bom_ids=json.loads(data.get('childs'))) + doc = self._get_pdf_line(bom_id, qty=quantity, child_bom_ids=json.loads(data.get('childs'))) else: - doc = self._get_pdf_line(bom_id, qty=float(data.get('quantity')), unfolded=True) + doc = self._get_pdf_line(bom_id, qty=quantity, unfolded=True) doc['report_type'] = 'pdf' doc['report_structure'] = data and data.get('report_type') or 'all' docs.append(doc)