Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
7167 Представления

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?

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
февр. 18
2598
2
окт. 17
6084
1
июн. 17
4481
0
мар. 21
2625
1
дек. 23
9139