Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
7151 Lượt xem

I need to pass `objects` to `email_template` from python code:


***.py**


    def _alert_product_expiry(self):

        alert_data = self.search([('alert_date','=',fields.Date.today())])

        if alert_data:

            template_id = self.env.ref('alert_email_template')// Need to pass `alert_data` to template

            send = template_id.send_mail(self.id, force_send=True)



**template_body**


      <field name="body_html">

            <![CDATA[

           //Retrieve that object here and perform for loop. I don't know how retrieve it.

    ]]>


   </field>


How can i do it?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

In your model of template make a field alert data and update on Python function. on XML templates access it from the object.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 18
2589
2
thg 10 17
6063
1
thg 6 17
4472
0
thg 3 21
2613
1
thg 12 23
9129