Odoo Help

Welcome!

This community 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.

0

[odoo:9] How to send email from python method?

By
Prince Caspion
on 7/18/16, 2:29 AM 257 views

Hello All,

I've created my own email template and email sever both are created.

Now how can i send an email to customer from python method?

I've follow some example of v8 api which are not working for me.

Any example which can help me to achieve this feature on v9

I tried but getting this error?

self.ensure_one()
 raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: mail.template()

Thank you.

Prince.    

1
Nikunj Antala
On 7/18/16, 3:18 AM

Hello Prince,

Try to use this code.

template=self.env.ref('External_ID_of_email_template')

template.send_mail(self.id,force_send=True)


Hope this helps.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/18/16, 2:29 AM
Seen: 257 times
Last updated: 7/18/16, 3:18 AM