Odoo Help


Modify email.template through a module [Closed]

on 6/30/15, 11:41 AM 2,290 views

The Question has been closed for reason: not a real question

Serpent Consulting Services Pvt. Ltd.
on 07/02/2015 06:36:07

Hi !

I know email template for invoices are defined under account/edi/invoice_action_data.xml, inside a CDATA tag, in the body_html field.

But, this part of the file if inside a data tag which has noupdate enabled.

Knowing that, is it possible to create a module to override invoice email (or any email template) ?

Because, you know, copy pasting the same code over multiple databases can be a pain, when you can just install your module and be done with it.


On 7/1/15, 3:33 AM

I used a workaround, in the end.

I just created a new email template.



You can update any of the email template using custom module. To override invoice email you need to just redefine that template inside your custom module as like below.

<record id="account.email_template_edi_invoice" model="email.template">

<field name="name">Invoice - Send by Email</field>

<field name="email_from">${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe}</field>

<field name="subject">${object.company_id.name|safe} 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_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">

<![CDATA[ "Write down your own template code here" ]] >



 It will override the existing email template of invoice.

I hope it will help you.

Thanks, I'll definitely try this.

on 7/1/15, 3:15 AM

No, that doesn't work.

on 7/1/15, 3:23 AM

I can also confirm that this doesn't work. For some reason it just does not want to update the email template.

Limitless Virtual Enterprise, Andre de Kock
on 7/1/15, 8:33 AM

Yeah, in v8, the update=1 on the original record prevents future overrides. See my answer here for a workaround: https://www.odoo.com/fr_FR/forum/help-1/question/how-to-override-your-company-data-through-a-custom-module-in-v8-87510 This could be applied to any object, or implemented directly into the Model class I suppose.

on 7/1/15, 10:40 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/30/15, 11:41 AM
Seen: 2290 times
Last updated: 7/2/15, 6:36 AM