İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
13145 Görünümler

Hello Everyone,

I am stuck in email templates inheritance.

I want to inherit two email template of same record id.

one email template is in sale module with record id "email_template_edi_sale"

and another one is in portal_sale module with same record id "email_template_edi_sale"

I need to inherit both.

I tried inherit by module_name.record id. but it can help because it is written inside noupdate="1"


Thanks is advance.

Avatar
Vazgeç
En İyi Yanıt

Step 1 :  We Need To noupdate set to False for mail template.

<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('name','=','email_template_edi_invoice'),('module','=','account')]"/>
function>
<value eval=" {'noupdate': False} "/>
function>

Step 2 : Override The Content and Changes as per our Custom Need.

<record id="account.email_template_edi_invoice" model="mail.template">        
    <field name="body_html" type="html">
        Here Mail Template Content.
    <field>

That's it...Thank you.

Avatar
Vazgeç
En İyi Yanıt

You should create an migration script, under your module, in order to deactivate the noupdate in the mail.template models to be able to update them in the -u process.

First create the next dirs

- migrations/module_version/

ej: migrations/11.0.2.0.2

And inside module version dir create files, post-migration.py and pre-migration.py

where you can made your script, something like the following:

https://gist.github.com/hugho-ad/8d4fa191f2484d3eaab3f87ed4110a01

 

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Ara 24
5336
0
Eki 15
3748
1
Mar 15
428
0
Tem 24
1140
2
Nis 23
2885