[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:
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user