Skip to Content
मेन्यू
This question has been flagged
1 Reply
7312 Views

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?

Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
फ़र॰ 18
2715
2
अक्तू॰ 17
6172
1
जून 17
4601
0
मार्च 21
2705
1
दिस॰ 23
9252