I was trying to create a new email template for invoices. What I did is to copy all the existing email template for invoices (xml id: email_template_edi_invoice
) except for the body_html
field. And here is the problem:
If I fill in the body_html
using CDATA
, I get the following asertion error:
Element odoo has extra content: data, line 6
However, if I do not use it, it works. I simplified the body_html
content, but the problem is still there.
The following email template works:
<?xml version="1.0" ?>
<odoo>
<data>
<!--Email template -->
<record id="email_template_edi_invoice_v8" model="mail.template">
<field name="name">Invoicing: Invoice email v8.0</field>
<field name="email_from">${(object.user_id.email and '"%s" <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field>
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a'})</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="account.account_invoices"/>
<field name="report_name">Invoice_${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html" type="html">
<div>
Hola
</div></field>
</record>
</data>
</odoo>
The following email template does not work (gives the extra content error):
<?xml version="1.0" ?>
<odoo>
<data>
<!--Email template -->
<record id="email_template_edi_invoice_v8" model="mail.template">
<field name="name">Invoicing: Invoice email v8.0</field>
<field name="email_from">${(object.user_id.email and '"%s" <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field>
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a'})</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="account.account_invoices"/>
<field name="report_name">Invoice_${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html" type="html"><![CDATA[
<div>
Hola
</div>]]></field>
</record>
</data>
</odoo>
Can anyone who experienced this problem give me a hint of what is happening?
<data></data>
tags, you might get a more useful error. Thedata
elements are no longer necessary unless you're wanting to usenoupdate="1"
. – traviswdata
tags but then the error message is Element odoo has extra content: record, line 8. – forvas${...}
pieces until it breaks again. – travisw