diff --git a/addons/mrp/__manifest__.py b/addons/mrp/__manifest__.py index 6a246fd7163..9a6505f037f 100644 --- a/addons/mrp/__manifest__.py +++ b/addons/mrp/__manifest__.py @@ -38,8 +38,6 @@ 'views/stock_scrap_views.xml', 'report/mrp_report_views_main.xml', 'report/mrp_production_templates.xml', - 'report/mrp_bom_structure_report_templates.xml', - 'report/mrp_bom_cost_report_templates.xml', ], 'demo': [ 'data/mrp_demo.xml', diff --git a/addons/mrp/report/__init__.py b/addons/mrp/report/__init__.py index 866d5e524c1..2903e8d9121 100644 --- a/addons/mrp/report/__init__.py +++ b/addons/mrp/report/__init__.py @@ -1,5 +1,3 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import mrp_bom_cost_report -from . import mrp_bom_structure_report diff --git a/addons/mrp/report/mrp_bom_cost_report.py b/addons/mrp/report/mrp_bom_cost_report.py deleted file mode 100644 index d71be4d1a7e..00000000000 --- a/addons/mrp/report/mrp_bom_cost_report.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import api, models - - -class MrpBomCost(models.AbstractModel): - _name = 'report.mrp.mrp_bom_cost_report' - - @api.multi - def get_lines(self, boms): - product_lines = [] - for bom in boms: - products = bom.product_id - if not products: - products = bom.product_tmpl_id.product_variant_ids - for product in products: - attributes = [] - for value in product.attribute_value_ids: - attributes += [(value.attribute_id.name, value.name)] - result, result2 = bom.explode(product, 1) - 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: - price_uom = bom_line.product_id.uom_id._compute_price(bom_line.product_id.standard_price, bom_line.product_uom_id) - line = { - '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'], - } - total += line['total_price'] - product_line['lines'] += [line] - product_line['total'] = total - product_lines += [product_line] - return product_lines - - @api.model - def get_report_values(self, docids, data=None): - boms = self.env['mrp.bom'].browse(docids) - res = self.get_lines(boms) - return {'lines': res} diff --git a/addons/mrp/report/mrp_bom_cost_report_templates.xml b/addons/mrp/report/mrp_bom_cost_report_templates.xml deleted file mode 100644 index 7e24d146281..00000000000 --- a/addons/mrp/report/mrp_bom_cost_report_templates.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - diff --git a/addons/mrp/report/mrp_bom_structure_report.py b/addons/mrp/report/mrp_bom_structure_report.py deleted file mode 100644 index a98f45b4754..00000000000 --- a/addons/mrp/report/mrp_bom_structure_report.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import api, models - - -class BomStructureReport(models.AbstractModel): - _name = 'report.mrp.mrp_bom_structure_report' - - def get_children(self, object, level=0): - result = [] - - def _get_rec(object, level, qty=1.0, uom=False): - for l in object: - res = {} - res['pname'] = l.product_id.name_get()[0][1] - res['pcode'] = l.product_id.default_code - qty_per_bom = l.bom_id.product_qty - if uom: - if uom != l.bom_id.product_uom_id: - qty = uom._compute_quantity(qty, l.bom_id.product_uom_id) - res['pqty'] = (l.product_qty *qty)/ qty_per_bom - else: - #for the first case, the ponderation is right - res['pqty'] = (l.product_qty *qty) - res['puom'] = l.product_uom_id - res['uname'] = l.product_uom_id.name - res['level'] = level - res['code'] = l.bom_id.code - result.append(res) - if l.child_line_ids: - if level < 6: - level += 1 - _get_rec(l.child_line_ids, level, qty=res['pqty'], uom=res['puom']) - if level > 0 and level < 6: - level -= 1 - return result - - children = _get_rec(object, level) - - return children - - @api.multi - def get_report_values(self, docids, data=None): - return { - 'doc_ids': docids, - 'doc_model': 'mrp.bom', - 'docs': self.env['mrp.bom'].browse(docids), - 'get_children': self.get_children, - 'data': data, - } diff --git a/addons/mrp/report/mrp_bom_structure_report_templates.xml b/addons/mrp/report/mrp_bom_structure_report_templates.xml deleted file mode 100644 index b9432776e88..00000000000 --- a/addons/mrp/report/mrp_bom_structure_report_templates.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - diff --git a/addons/mrp/report/mrp_report_views_main.xml b/addons/mrp/report/mrp_report_views_main.xml index 064558ddad1..1faaa04ca69 100644 --- a/addons/mrp/report/mrp_report_views_main.xml +++ b/addons/mrp/report/mrp_report_views_main.xml @@ -1,16 +1,6 @@ - - - - diff --git a/addons/mrp/views/mrp_bom_views.xml b/addons/mrp/views/mrp_bom_views.xml index 5412aebf313..535ea3466aa 100644 --- a/addons/mrp/views/mrp_bom_views.xml +++ b/addons/mrp/views/mrp_bom_views.xml @@ -192,38 +192,6 @@ - - mrp.bom.component.tree - mrp.bom.line - - - - - - - - - - - - - - mrp.bom.line.select - mrp.bom.line - - - - - - - - - - - - - - {'default_product_tmpl_id': active_id, 'search_default_product_tmpl_id': active_id} Bill of Materials