diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py index e5bd8171c60..bc7dfc7ec29 100644 --- a/addons/mrp/__openerp__.py +++ b/addons/mrp/__openerp__.py @@ -74,6 +74,7 @@ Dashboard / Reports for MRP will include: 'res_config_view.xml', 'views/report_mrporder.xml', + 'views/report_mrpbomstructure.xml', ], 'demo': ['mrp_demo.xml'], #TODO: This yml tests are needed to be completely reviewed again because the product wood panel is removed in product demo as it does not suit for new demo context of computer and consultant company diff --git a/addons/mrp/mrp_report.xml b/addons/mrp/mrp_report.xml index 781615588a7..29c848acbe4 100644 --- a/addons/mrp/mrp_report.xml +++ b/addons/mrp/mrp_report.xml @@ -1,8 +1,14 @@ - - + + xsl="mrp/report/price.xsl" + /> diff --git a/addons/mrp/report/bom_structure.py b/addons/mrp/report/bom_structure.py index b153ea2e4e9..9af4e91b8ce 100644 --- a/addons/mrp/report/bom_structure.py +++ b/addons/mrp/report/bom_structure.py @@ -19,16 +19,24 @@ # ############################################################################## -import time -from openerp.report import report_sxw +from openerp.addons.web import http +from openerp.addons.web.http import request -class bom_structure(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(bom_structure, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - 'get_children':self.get_children, - }) + +class bom_structure(http.Controller): + + @http.route(['/report/mrp.report_mrpbomstructure/'], type='http', auth='user', website=True, multilang=True) + def report_mrpbomstructure(self, docids): + ids = [int(i) for i in docids.split(',')] + ids = list(set(ids)) + report_obj = request.registry['mrp.bom'] + docs = report_obj.browse(request.cr, request.uid, ids, context=request.context) + + docargs = { + 'docs': docs, + 'get_children': self.get_children, + } + return request.registry['report'].render(request.cr, request.uid, [], 'mrp.report_mrpbomstructure', docargs) def get_children(self, object, level=0): result = [] @@ -56,7 +64,4 @@ class bom_structure(report_sxw.rml_parse): return children -report_sxw.report_sxw('report.bom.structure','mrp.bom','mrp/report/bom_structure.rml',parser=bom_structure,header='internal') - - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/report/bom_structure.rml b/addons/mrp/report/bom_structure.rml deleted file mode 100644 index cdc27c08d87..00000000000 --- a/addons/mrp/report/bom_structure.rml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BOM Name - - - Product Name - - - Quantity - - - BOM Ref - - - - - - BOM Structure - - - - BOM Name - - - Product Name - - - Quantity - - - BOM Ref - - - -
- [[ repeatIn(objects, 'o') ]] - - - - [[ o.name ]] - - - [ [[ (o.product_id.default_code) or removeParentNode('font') ]] ] [[ o.product_id.name ]] - - - [[ o.product_qty ]] [[ o.product_uom.name ]] - - - [[ o.code ]] - - - -
- [[ repeatIn(get_children(o.bom_lines), 'l') ]] - - - - [[ '... '*(l['level']) ]] - [[ l['name'] ]] - - - [ [[ (l['pcode']) or removeParentNode('font') ]] ] [[ l['pname'] ]] - - - [[ l['pqty'] ]] [[ l['uname'] ]] - - - [[ l['code'] ]] - - - -
-
-
-
-
\ No newline at end of file diff --git a/addons/mrp/test/order_process.yml b/addons/mrp/test/order_process.yml index 088cdf4311a..9fa13bbf33d 100644 --- a/addons/mrp/test/order_process.yml +++ b/addons/mrp/test/order_process.yml @@ -224,20 +224,6 @@ assert line.journal_id.id == wc.costs_journal_id.id, "Account Journal is not correspond." assert line.product_id.id == wc.product_id.id, "Product is not correspond." assert line.product_uom_id.id == wc.product_id.uom_id.id, "UOM is not correspond." -- - I print a "BOM Structure". -- - !context - uid: 'res_users_mrp_user' -- - !python {model: mrp.production}: | - import os - import openerp.report - from openerp import tools - order = self.browse(cr, uid, ref("mrp_production_test1")) - data, format = openerp.report.render_report(cr, uid, [order.bom_id.id], 'bom.structure', {}, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'mrp-bom_structure_report.'+format), 'wb+').write(data) - I print "Work Center Load Report". - diff --git a/addons/mrp/views/report_mrpbomstructure.xml b/addons/mrp/views/report_mrpbomstructure.xml new file mode 100644 index 00000000000..ae5469dbc17 --- /dev/null +++ b/addons/mrp/views/report_mrpbomstructure.xml @@ -0,0 +1,55 @@ + + + + + +