Skip to Content
Menu
This question has been flagged
3 Replies
10240 Views

Hello,

In Odoo 9 I was able to inherit from sale.report_saleorder in order to override the sale order default report when we click on 'Print'-'Quotation/Order' on a quotation or a sale order. To do this I wrote:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="holding_report_saleorder" inherit_id="sale.report_saleorder">
            <xpath expr="//t[1]" position="replace">
                <t t-call="report.html_container">
                    <t t-foreach="docs" t-as="doc">
                        <t t-call="sitoprix.sitoprix_report_saleorder_document" t-lang="doc.partner_id.lang"/>
                     </t>
                </t>
            </xpath>
        </template>
    </data>
</openerp>

But in Odoo 10 I got the following error:

Traceback (most recent call last):
  File "/home/rgeromeg/workspace/odoo10/erp/core/addons/report/controllers/main.py", line 96, in report_download
    response = self.report_routes(reportname, docids=docids, converter='pdf')
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/http.py", line 504, in response_wrap
    response = f(*args, **kw)
  File "/home/rgeromeg/workspace/odoo10/erp/core/addons/report/controllers/main.py", line 45, in report_routes
    pdf = report_obj.with_context(context).get_pdf(docids, reportname, data=data)
  File "/home/rgeromeg/workspace/odoo10/erp/core/addons/report/models/report.py", line 178, in get_pdf
    html = self.with_context(context).get_html(docids, report_name, data=data)
  File "/home/rgeromeg/workspace/odoo10/erp/core/addons/report/models/report.py", line 144, in get_html
    return self.render(report.report_name, docargs)
  File "/home/rgeromeg/workspace/odoo10/erp/core/addons/report/models/report.py", line 120, in render
    return view_obj.render_template(template, values)
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/addons/base/ir/ir_ui_view.py", line 1036, in render_template
    return self.browse(self.get_view_id(template)).render(values, engine)
  File "/home/rgeromeg/workspace/odoo10/erp/core/addons/website/models/ir_ui_view.py", line 110, in render
    return super(View, self).render(values, engine=engine)
  File "/home/rgeromeg/workspace/odoo10/erp/core/addons/web_editor/models/ir_ui_view.py", line 26, in render
    return super(IrUiView, self).render(values=values, engine=engine)
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/addons/base/ir/ir_ui_view.py", line 1056, in render
    return self.env[engine].render(self.id, qcontext)
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/addons/base/ir/ir_qweb/ir_qweb.py", line 53, in render
    return super(IrQWeb, self).render(id_or_xml_id, values=values, **context)
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/addons/base/ir/ir_qweb/qweb.py", line 248, in render
    self.compile(template, options)(self, body.append, values or {})
  File "<string>", line 2, in compile
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/tools/cache.py", line 87, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/addons/base/ir/ir_qweb/ir_qweb.py", line 73, in compile
    return super(IrQWeb, self).compile(id_or_xml_id, options=options)
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/addons/base/ir/ir_qweb/qweb.py", line 265, in compile
    element, document = self.get_template(template, options)
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/addons/base/ir/ir_qweb/qweb.py", line 366, in get_template
    raise QWebException("Template not found", name=template)
QWebException: None
Traceback (most recent call last):
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/tools/cache.py", line 82, in lookup
    r = d[key]
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/tools/func.py", line 68, in wrapper
    return func(self, *args, **kwargs)
  File "/home/rgeromeg/workspace/odoo10/erp/core/odoo/tools/lru.py", line 43, in __getitem__
    a = self.d[obj].me
KeyError: ('ir.qweb', <function compile at 0x7fab48fdec08>, 721, (u'en_US', True, None, None, None))

Template not found
Template: 721

Avatar
Discard
Best Answer

Hello,

The template id for sale order/Quotation is report_saleorder_document.

You can inherit it and make required changes

For more details refer /sale/report/sale_report_templates.xml

Avatar
Discard
Best Answer

There have been many changes between the different versions. You should check them when you migrate a module.

Avatar
Discard
Related Posts Replies Views Activity
0
Apr 21
847
1
Oct 23
4579
1
Sep 24
24095
1
Dec 22
9366
2
Jun 20
4154