تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
8956 أدوات العرض

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.



الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
أفضل إجابة

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()

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مايو 16
10676
0
فبراير 25
1114
0
نوفمبر 24
1278
2
فبراير 23
2312
1
مايو 15
6749