Reputation: 91
I have developed a new report for account.invoice in odoo 12 but when i suppose to print this, it gives me a warning like this in 12.0 branch :
The report's template 'Template name' is wrong, please contact your administrator.
Can not separate file to save as attachment because the report's template does not contains the attributes 'data-oe-model' and 'data-oe-id' on the div with 'article' classname.
In master branch it says data-model instead of data-oe-model, data-id instead of data-oe-id and 'page' classname instead of 'article' classname
If anyone has faced the same issue and find a solution then please let me know.
Thanks
Upvotes: 2
Views: 6962
Reputation: 2818
I had faced same issue.
The reason was there is a t-if
condition before the <t t-call="web.external_layout">
. The error is coming when ever its value is False.
Upvotes: 0
Reputation: 308
This error could happen if there is no report_type="qweb-html" for the report_type="qweb-pdf". To solve this issue just had both... something like this :
<report
id="report_invoice_html"
model="MY_MODEL_NAME"
string="Invoice HTML"
name="MODULE.report_invoice_view"
file="MODULE.report_invoice"
report_type="qweb-html" />
<report
id="report_invoice_pdf"
model="MY_MODEL_NAME"
string="Invoice PDF"
name="MODULE.report_invoice_view"
file="MODULE.report_invoice"
report_type="qweb-pdf" />
If you look at the Odoo code source at ir_actions_report.py, you will see a statement comparing set(res_ids) != set(html_ids), if HTML template doesn't exist it return True, and then raise the Error
Upvotes: -1
Reputation: 47
Yes, you need to modify the external_layout, In my case it was custom layout and i solved it using below XML
<template id="custom_layout">
<!-- Multicompany -->
<div class="article o_report_layout_standard" t-att-data-oe-model="doc and doc._name" t-att-data-oe-id="doc and doc.id">
<t t-if ="doc and 'company_id' in doc" >
<t t-set="company" t-value="doc.company_id"/>
<t t-set="customer" t-value="doc.partner_id"/>
</t>
<t t-call="custom_sale_report_v12.custom_layout_header"/>
<t t-raw="0"/>
<t t-call="ce_sale_report_v12.custom_layout_footer"/>
</div>
</template>
Upvotes: 0
Reputation: 970
I solved it with a help from a friend:
In your external_layout you have to define 't-att-data-oe-model' and 't-att-data-oe-id' . Add this:
<div class="article o_report_layout_standard" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id">
<t t-call="web.address_layout"/>
<t t-raw="0"/>
</div>
Previously this piece of code (v11) was like this:
<div class="article o_report_layout_standard">
<t t-raw="0" />
</div>
Hope it solves your problem. This change is because the report is now editable in v12 with the studio app.
Upvotes: 3