[FIX] mail: fixed bug adding signature of partners without users, therefore without signature field; fixed message_id of mail.message without model,res_id, that were not granted a message_id, therefore generated when sending a mail.mail, therefore breaking parent relationship based on message_id. Also fixed content_subtype of message coming from message_process.

bzr revid: tde@openerp.com-20121108164138-8jp2340t6s2sa9hd
This commit is contained in:
Thibault Delavallée
2012-11-08 17:41:38 +01:00
parent 7e1369cca8
commit acb1156ee5
3 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -160,7 +160,7 @@ class mail_notification(osv.Model):
pass
# print quote_context
# body_html = tools.append_content_to_html(body_html, quote_context, plaintext=False)
signature = msg.author_id and msg.author_id.user_ids[0].signature or ''
signature = msg.author_id and msg.author_id.user_id and msg.author_id.user_ids[0].signature or ''
if signature:
body_html = tools.append_content_to_html(body_html, tools.text2html(signature), plaintext=False)
+2
View File
@@ -600,6 +600,8 @@ class mail_message(osv.Model):
def create(self, cr, uid, values, context=None):
if not values.get('message_id') and values.get('res_id') and values.get('model'):
values['message_id'] = tools.generate_tracking_message_id('%(res_id)s-%(model)s' % values)
elif not values.get('message_id'):
values['message_id'] = tools.generate_tracking_message_id('private')
newid = super(mail_message, self).create(cr, uid, values, context)
self._notify(cr, SUPERUSER_ID, newid, context=context)
return newid
+1 -1
View File
@@ -452,7 +452,7 @@ class mail_thread(osv.AbstractModel):
thread_id = model_pool.message_new(cr, user_id, msg, custom_values, context=context)
else:
model_pool = self.pool.get('mail.thread')
model_pool.message_post_user_api(cr, uid, [thread_id], context=context, **msg)
model_pool.message_post_user_api(cr, uid, [thread_id], context=context, content_subtype='html', **msg)
return thread_id
def message_new(self, cr, uid, msg_dict, custom_values=None, context=None):