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

Hi Guys.

I developed a module in odoo 12. And now i am need that  module send a email to user when he finish you action. But i dont know how to make my module send that email automatically. Some of you guys can help me with that? 

Thanks a lot.



Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

Either you can use the automated action to send the email or you can send the email using the python code. 


For sending the email is using the automated action what you have to do is that, activate the developer mode and navigate to Settings -> Technical -> Automation -> Automated Actions, here you can create a record for sending email for the purpose. Make sure that the module with the technical name base_automation is installed in the database, if not you cannot see the specified menu. Here create a new record, in the Action To Do field choose the Send Email option. You can create this from the user interface or by the code.


For sending the email from the code, either you can send the email using a template or without the template. For sending the email using the email template see this blog: Finding and sending e-mail templates in Odoo


Thanks

Imagine profil
Abandonează
Cel mai bun răspuns

to send an email write the following code in method you are calling

def method(self):

mail_obj = self.env['mail.mail']​

body_html = "<p>message</p>"

mail = mail_obj.create({
'body_html':body_html,
'email_to':(user email field),
})
mail.send()

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
mai 16
10800
0
feb. 25
1292
0
nov. 24
1426
2
feb. 23
2457
1
mai 15
6850