콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
7144 화면

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
2월 18
2585
2
10월 17
6052
1
6월 17
4465
0
3월 21
2613
1
12월 23
9126