تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
7146 أدوات العرض

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.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
فبراير 18
2586
2
أكتوبر 17
6052
1
يونيو 17
4465
0
مارس 21
2613
1
ديسمبر 23
9127