Skip to Content
Menu
This question has been flagged
1 Reply
4426 Views

My doubt centers in how can i stablish templates where the program automatically changes the variable of the contact name on the text i want to send to my contact list with the purpose of eliminated the task of doing it manually in each email. Right now we're using odoo 12.0. Thanks for your help on this matter!

Avatar
Discard
Best Answer

Hi Manuel,

You can create your own e-mail template to do this. Either through XML or through the frontend of Odoo.
I've got an example available on Github at https://github.com/Yenthe666/Odoo_Samples/blob/master/mail_template_demo/views/mail_template.xml
The great part is that Odoo uses Jinja2 in order to use and parse variables to the values of a record. So you can use any option that is available in default to use in e-mail templates. For example: if you want to convert the field 'name' of the model 'res.partner' so that it shows the actual name of the customer in the e-mail you can do it as follows:

<p>Dear ${(object.name)},<br/><br/></p>

You can also find a lot of great examples in the official Odoo code. Have a look at https://github.com/odoo/odoo/search?l=XML&q=mail.template

Regards,
Yenthe

Avatar
Discard