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

Is there already a simple method to directly post an E-Mail Template with message_post ? [Closed]

By
Michael Karrer
on 7/21/14, 10:38 AM 940 views

The Question has been closed for reason: duplicate question

by
Michael Karrer
on 07/21/2014 11:52:49

I created a method that posts a message on every save to products.product. I post the message with:

self.message_post(cr, uid, pprecord['id'], body='My nice message body', subject='My nice message subject')

But now i would like to use an existing E-Mail Template instead of simple strings to post the message.

Is there already a simple method to directly post an E-Mail Template? 

I played around with: self.pool.get('email.template').render_template(cr, uid, 3, 'product.product', pprecord['id'], context=context) but all i want is to post the E-Mail template and not to read all the fields one by one...

 

0
Michael Karrer
On 7/21/14, 11:53 AM

Already answerd in an other Question. https://www.odoo.com/forum/help-1/question/how-to-send-invoice-mail-automatically-24620

0

Ben Bernard

--Ben Bernard--
1083
| 4 3 6
Jakarta, Indonesia
--Ben Bernard--
Ben Bernard
On 7/21/14, 11:18 AM

Make appropriate email template via Settings > Configuration > Email > Templates. Name it like 'my_template'.

email_pool = self.pool.get('email.template)

ids = email_pool.search(cr, uid, [{'name', '=', 'my_template'}])

body = email_pool.render_template(cr, uid, ids[0], 'product.product', pprecord['id'], context=context)

self.message_post(cr, uid, pprecord['id'], body=body, subject='My nice message subject')

 

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/21/14, 10:38 AM
Seen: 940 times
Last updated: 3/16/15, 8:10 AM