Odoo Help

1

Automatically send email when I submited a form.

By
aneesh ATEES Infomedia Pvt Ltd
on 2/11/15, 2:44 AM 2,758 views

Dear Sir/Madam,
How could I automatically send email when I submited a form.
Thank You

1
Jordan Vrtanoski
On 2/11/15, 3:24 AM

You need to have a python code that will generate the mail and send. You can place the below code (and modify it to fit your needs) in the model for which you want to send email, and than call the method send_mail("name of the temlate") from the code that handles your form submission, or I prefer to have a workflow associated with the model and send mail from the actions in the workflow.

    def send_mail(self, cr, uid, ids, context=None, template=""):
       for object in self.browse(cr, uid, ids, context=context):
            # Check if the parnter has "opt_out" for the mail
            if (not
object.partner_id.opt_out):
                template_id =
self.pool.get('email.template').search(cr, uid, [("name","=",template)])
                if template_id:
                    mail_message = self.pool.get('email.template').send_mail(cr,uid,template_id[0],object.id)

 

PLEASE GIVE ME ONE COMPLETE EXAPMPLE

aneesh ATEES Infomedia Pvt Ltd
on 2/27/15, 10:17 PM

Can you explain? The code above is a compete example of sending email, all you need to do is to add the code to your model and call the self.send_mail from the place you need.

Jordan Vrtanoski
on 2/28/15, 1:07 AM
1

Vasanth

--Vasanth--
3478
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 2/11/15, 3:16 AM

hi aneesh,

you can sent the email automatically by using server actions.

You see the following link for using the automated email:

http://stackoverflow.com/questions/23908437/how-to-create-program-for-sending-mail-automatically-from-openerp-using-python

https://www.odoo.com/forum/help-1/question/create-a-module-for-automatic-send-email-when-customer-has-been-created-59924

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 2/11/15, 2:44 AM
Seen: 2758 times
Last updated: 9/27/16, 1:21 AM