Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
7177 Vizualizări

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])
Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Cel mai bun răspuns

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



Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
iul. 24
1811
1
iul. 25
744
5
mai 25
18170
0
apr. 25
1062
1
apr. 25
1553