跳至內容
選單
此問題已被標幟
2 回覆
7178 瀏覽次數

I trying to send an email to a partner while create a document. The message is creates but not sending to the partner. Below is my code.

*.py

@api.model
def create(self,vals):
    result = super(HRHolidays,self).create(vals)
    message_sent = result.message_post(message_type='notification', subtype='mt_comment', partner_ids=[25])
頭像
捨棄
最佳答案

I have a code that sends email on button click, you can use this on our create method as well.

Have a look please: http://learnopenerp.blogspot.com/2017/08/odoo-how-to-send-email-on-button-click.html

Thanks

頭像
捨棄
最佳答案

Hi Kabeer,

 

1st solution,

  • result.message_subscribe([25])

  • result.message_post(body="Test Message",  message_type="notification", subtype="mail.mt_comment")


2nd solution,

  • result.message_post(body="Test Message",  message_type="notification", subtype="mail.mt_comment", partner_ids=[25] )


in your case,

@api.model
def create(self,vals):
    result = super(HRHolidays,self).create(vals)
    result.message_post(
        message_type='notification',
        subtype='mail.mt_comment',
        partner_ids=[25]
    )
    return result



頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
7月 24
1811
1
7月 25
744
5
5月 25
18170
0
4月 25
1062
1
4月 25
1553