[FIX] mail: added wrapper for message_Create_patners_from_emails in mail_thread and res_users; cleaned message_post signature to match the pre-merge signature. Also fixed a wrong argument name in message_post_user_api.

bzr revid: tde@openerp.com-20130307075216-kk0m304405ohm7ua
This commit is contained in:
Thibault Delavallée 2013-03-07 08:52:16 +01:00
parent 445c1aa412
commit e57ffc4836
2 changed files with 27 additions and 4 deletions

View File

@ -883,9 +883,9 @@ class mail_thread(osv.AbstractModel):
mail_message_obj.write(cr, SUPERUSER_ID, message_ids, {'author_id': ids[0]}, context=context)
return result
def message_post(self, cr, uid, thread_id, body='', subject=None,
content_subtype='html', type='notification', subtype=None,
parent_id=False, attachments=None, context=None, **kwargs):
def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification',
subtype=None, parent_id=False, attachments=None, context=None,
content_subtype='html', **kwargs):
""" Post a new message in an existing thread, returning the new
mail.message ID.
@ -1030,11 +1030,19 @@ class mail_thread(osv.AbstractModel):
self.message_subscribe(cr, uid, [thread_id], [message.author_id.id], context=context)
return msg_id
#------------------------------------------------------
# Compatibility methods: do not use
# TDE TODO: remove me in 8.0
#------------------------------------------------------
def message_create_partners_from_emails(self, cr, uid, emails, context=None):
return {'partner_ids': [], 'new_partner_ids': []}
def message_post_user_api(self, cr, uid, thread_id, body='', parent_id=False,
attachment_ids=None, content_subtype='plaintext',
context=None, **kwargs):
return self.message_post(cr, uid, thread_id, body=body, parent_id=parent_id,
attachment_ids=attachment_ids, content_suibtype=content_subtype,
attachment_ids=attachment_ids, content_subtype=content_subtype,
context=context, **kwargs)
#------------------------------------------------------

View File

@ -148,6 +148,21 @@ class res_users(osv.Model):
partner_ids.append(self.browse(cr, SUPERUSER_ID, id).partner_id.id)
return self.pool.get('res.partner').message_get_suggested_recipients(cr, uid, partner_ids, context=context)
#------------------------------------------------------
# Compatibility methods: do not use
# TDE TODO: remove me in 8.0
#------------------------------------------------------
def message_post_user_api(self, cr, uid, thread_id, context=None, **kwargs):
""" Redirect the posting of message on res.users to the related partner.
This is done because when giving the context of Chatter on the
various mailboxes, we do not have access to the current partner_id. """
partner_id = self._message_post_get_pid(cr, uid, thread_id, context=context)
return self.pool.get('res.partner').message_post_user_api(cr, uid, partner_id, context=context, **kwargs)
def message_create_partners_from_emails(self, cr, uid, emails, context=None):
return self.pool.get('res.partner').message_create_partners_from_emails(cr, uid, emails, context=context)
class res_users_mail_group(osv.Model):
""" Update of res.users class