[IMP] mail_thread: notification email sending: fixed and cleaned body of email. Will need an upgrade of style, but the mechanism is basically there.

bzr revid: tde@openerp.com-20120511125830-bjucro0f7p3pumtv
This commit is contained in:
Thibault Delavallée 2012-05-11 14:58:30 +02:00
parent c4b38f4858
commit 4232d142a2
1 changed files with 10 additions and 3 deletions

View File

@ -902,15 +902,22 @@ class mail_thread(osv.osv):
def message_create_notify_get_email_dict(self, cr, uid, new_msg_values, email_from, email_to, context=None):
values = dict(new_msg_values)
body = new_msg_values.get('body_html', '') if new_msg_values.get('content_subtype') == 'html' else new_msg_values.get('body_text', '')
body += '\n\n----------\nThis email was send automatically by OpenERP, because you have subscribed to a document.'
body_html = new_msg_values.get('body_html', '')
if body_html:
body_html += '\n\n----------\nThis email was send automatically by OpenERP, because you have subscribed to a document.'
body_text = new_msg_values.get('body_text', '')
if body_text:
body_text += '\n\n----------\nThis email was send automatically by OpenERP, because you have subscribed to a document.'
values.update({
'type': 'email',
'state': 'outgoing',
'email_from': email_from,
'email_to': email_to,
'subject': 'New message',
'content_subtype': 'text',
'content_subtype': new_msg_values.get('content_subtype', 'plain'),
'body_html': body_html,
'body_text': body_text,
'auto_delete': True,
'res_model': '',
'res_id': False,