Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
14702 มุมมอง

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:
<ul>
<li>${name}</li>
</ul>
%endfor

Is it possible to do in email template?..

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

context['email_to']='xyz@gmail.com'

            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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ต.ค. 16
5082
2
ม.ค. 24
4342
Problem with email template (SOLVED) แก้ไขแล้ว
2
ม.ค. 24
10029
Email Template subject parameters แก้ไขแล้ว
1
ก.พ. 24
2610
1
ก.ค. 23
3512