Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
700 Lượt xem

Hi All,

I have created a custom stage in the Contacts module and add a Many2one field for mail template in stage.
I want to send that mail whenever the contact moves next stage.

below is the custom stage



below is the mail template



mail template configured in custom stage


how does mail should trigger when stage change

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

got the answer

def _track_template(self, changes):

        res = super(Contact, self)._track_template(changes)

        contact_stage = self[0]

        if 'stage_id' in changes and contact_stage.stage_id.mail_template_id:

            res['stage_id'] = (contact_stage.stage_id.mail_template_id, {

                'auto_delete_keep_log': False,

                'subtype_id': self.env['ir.model.data']._xmlid_to_res_id('mail.mt_note'),

                'email_layout_xmlid': 'mail.mail_notification_light',

            })

        return res

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 25
915
0
thg 5 22
2152
0
thg 5 21
1616
0
thg 9 16
3572
2
thg 7 16
5103