Odoo Help

1 Answer
Haresh Kansara
1/12/19, 4:21 PM

Hi Berctain,

To render email template object in your module you need to follow bellow steps:

ir_model_obj = self.env['ir.model.data']

# browse template reference from model data

template_browse = ir_model_obj.get_object_reference('module_name', 'email_template_id')[1] 

# browse email template 

email_template_obj = self.env['mail.template'].browse(template_browse)

# Generate email template for specific record

values = email_template_obj.generate_email(res_id) # it is to generate email for specific object record

Refer: https://www.odoo.com/forum/help-1/question/correct-way-to-e-mail-custom-html-record-in-function-96570


Hope it will useful for you..

1 Comment
1/12/19, 8:09 PM


Note worked.

do these are miss typed or some thing?

'email_template_id' instead of 'email_template'


self.env['mail.template'] instead of self.env['email.template']

and the first error i get is this >> the External id not found res_cores_int.email_template_id even when i change it too email.template its same

res.core.int is my module name

Ask a Question
Keep Informed
1 follower(s)
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