diff options
| author | Kaushalya Mandaliya <kma@odoo.com> | 2019-07-16 08:33:52 +0000 |
|---|---|---|
| committer | Kaushalya Mandaliya <kma@odoo.com> | 2019-07-30 10:33:16 +0000 |
| commit | 03c2083890d95d37d0e5f045bf04b8a77632e82c (patch) | |
| tree | 70d81bba423ffa121805abbb8e1794b790206d79 | |
| parent | af80c68ae50159d21977692c6d283c4067254edd (diff) | |
[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) <sle@openerp.com>
| -rw-r--r-- | addons/mrp/report/mrp_report_bom_structure.py | 9 |
1 files 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) |
