I'm trying to modify the order / quotation report to hide unit price in each line of the products and only show total price for the quotation and units of each item.
To achieve it I created a module following the tutorial from \here. I've been able to modify the original view by inheriting it but when I create a new report with an inherited view and setting it as primary="True" I can't print it and it gives error.
Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 348, in _compiled_fn return compiled(self, append, new, options, log) File "", line 1, in template_1656_2177 File "", line 2, in body_call_content_2176 AttributeError: 'NoneType' object has no attribute 'with_context' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1686, in report_download response = self.report_routes(reportname, docids=docids, converter=converter) File "/usr/lib/python3/dist-packages/odoo/http.py", line 519, in response_wrap response = f(*args, **kw) File "/usr/local/lib/python3.5/dist-packages/odoo/addons/report_xml/controllers/main.py", line 41, in report_routes reportname, docids, converter, **data) File "/usr/lib/python3/dist-packages/odoo/http.py", line 519, in response_wrap response = f(*args, **kw) File "/usr/local/lib/python3.5/dist-packages/odoo/addons/report_xlsx/controllers/main.py", line 59, in report_routes reportname, docids, converter, **data File "/usr/lib/python3/dist-packages/odoo/http.py", line 519, in response_wrap response = f(*args, **kw) File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1627, in report_routes pdf = report.with_context(context).render_qweb_pdf(docids, data=data)[0] File "/usr/local/lib/python3.5/dist-packages/odoo/addons/mis_builder/report/mis_report_instance_qweb.py", line 28, in render_qweb_pdf return super(Report, self).render_qweb_pdf(res_ids, data) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 727, in render_qweb_pdf html = self.with_context(context).render_qweb_html(res_ids, data=data)[0] File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 767, in render_qweb_html return self.render_template(self.report_name, data), 'html' File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 540, in render_template return view_obj.render_template(template, values) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 1338, in render_template return self.browse(self.get_view_id(template)).render(values, engine) File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_ui_view.py", line 29, in render return super(IrUiView, self).render(values=values, engine=engine, minimal_qcontext=minimal_qcontext) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 1347, in render return self.env[engine].render(self.id, qcontext) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb.py", line 59, in render result = super(IrQWeb, self).render(id_or_xml_id, values=values, **context) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 275, in render self.compile(template, options)(self, body.append, values or {}) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 355, in _compiled_fn raise QWebException("Error to render compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name) odoo.addons.base.models.qweb.QWebException: 'NoneType' object has no attribute 'with_context' Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 348, in _compiled_fn return compiled(self, append, new, options, log) File "", line 1, in template_1656_2177 File "", line 2, in body_call_content_2176 AttributeError: 'NoneType' object has no attribute 'with_context' Error to render compiling AST AttributeError: 'NoneType' object has no attribute 'with_context' Template: 1656 Path: /templates/t/t/t[1] Node:
I think that this is because I'm inheriting the sale.report_saleorder_document which doesn't take into account the doc.partner_id.lang\ parameter but to pass the value of the language I would have to inherit the sale.report_saleorder which has the following code:
But if I inherit this view then I can't use xpath to modify the view which this view is already inheriting.
How can I pass that parameter to the inherited view from my new template? Or is ther any other workaround I'm missing?