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

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
2585
2
ต.ค. 17
6050
why custom report not changed in email? แก้ไขแล้ว
1
มิ.ย. 17
4465
0
มี.ค. 21
2613
1
ธ.ค. 23
9126