Odoo Help


Email templates - use different objects in one template

Tomas Parnarauskas
on 5/1/13, 9:37 AM 4,560 views

Is it possible to use two different objects in one template? Let say I write template that applies to res.partner, then I use this object to build letter. But in that same letter I want to add list of products that are in my database. So I would use product.template. as res.partner does not have direct link to products I don't see a way where I could use like:

object.[link to product.template] So I would like to use it like:

<p>Hello ${object.name}</p>
<p>Here is our product list:</p>
%for name product_template.name:

Is it possible to do in email template?..

Nishant Kashyap
On 7/19/13, 4:59 AM

You can use the Context to send the data you want in the template. For Example:


            template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'module_name', 'module_name_email_template_id')[1]
            self.pool.get('email.template').send_mail(cr, uid, template_id, record.id, force_send=True, context=context)

And In the Email Template:

<field name="email_to">${ctx.get('email_to')}</field>

Thanks I'll keep that in mind.

NOD Baltic, UAB, Tomas Parnarauskas
on 7/19/13, 5:56 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

0 follower(s)


Asked: 5/1/13, 9:37 AM
Seen: 4560 times
Last updated: 9/28/17, 12:33 PM