From 1bdca992c1dd70acc1b7016a992d6d27da03ea09 Mon Sep 17 00:00:00 2001 From: Jignesh Rathod Date: Mon, 18 Jul 2016 15:40:49 +0530 Subject: [PATCH] [IMP] MRP : Improve bom cost report. Use HTML version instead --- addons/mrp/report/bom_cost.py | 9 +++--- addons/mrp/report/bom_cost.xml | 36 ++++++++++++--------- addons/mrp/report/mrp_report_views_main.xml | 2 +- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/addons/mrp/report/bom_cost.py b/addons/mrp/report/bom_cost.py index 70461a713fb..52e46f26b06 100644 --- a/addons/mrp/report/bom_cost.py +++ b/addons/mrp/report/bom_cost.py @@ -19,18 +19,17 @@ class MrpBomCost(models.AbstractModel): for value in product.attribute_value_ids: attributes += [(value.attribute_id.name, value.name)] result, result2 = bom.explode(product, 1) - product_line = {'name': product.name, 'lines': [], 'total': 0.0, + product_line = {'bom': bom, 'name': product.name, 'lines': [], 'total': 0.0, 'currency': self.env.user.company_id.currency_id, 'product_uom_qty': bom.product_qty, 'product_uom': bom.product_uom_id, 'attributes': attributes} total = 0.0 for bom_line, line_data in result2: - line_product = line_data['product'] - price_uom = self.env['product.uom']._compute_qty(line_product.uom_id.id, line_product.standard_price, bom_line.product_uom_id.id) + price_uom = self.env['product.uom']._compute_qty(bom_line.product_id.uom_id.id, bom_line.product_id.standard_price, bom_line.product_uom_id.id) line = { - 'product_id': line_product, - 'product_uom_qty': line_data['qty'], + 'product_id': bom_line.product_id, + 'product_uom_qty': line_data['qty'], #line_data needed for phantom bom explosion 'product_uom': bom_line.product_uom_id, 'price_unit': price_uom, 'total_price': price_uom * line_data['qty'], diff --git a/addons/mrp/report/bom_cost.xml b/addons/mrp/report/bom_cost.xml index 3237e55c47a..b4d3158527a 100644 --- a/addons/mrp/report/bom_cost.xml +++ b/addons/mrp/report/bom_cost.xml @@ -1,10 +1,10 @@ diff --git a/addons/mrp/report/mrp_report_views_main.xml b/addons/mrp/report/mrp_report_views_main.xml index 4bc22e4d16f..9a74c610f35 100644 --- a/addons/mrp/report/mrp_report_views_main.xml +++ b/addons/mrp/report/mrp_report_views_main.xml @@ -24,7 +24,7 @@ model="mrp.bom" name="mrp_bom_cost" file="mrp_bom_cost" - report_type="qweb-pdf" + report_type="qweb-html" />