[FIX] mail: added wrapper because of changes introduced in the API recently.
bzr revid: tde@openerp.com-20130306162811-t4505m08nep2jlz4
This commit is contained in:
parent
d1c7b2bf3c
commit
445c1aa412
|
@ -931,7 +931,18 @@ class mail_thread(osv.AbstractModel):
|
|||
body = tools.plaintext2html(body)
|
||||
|
||||
# 2: Private message: add recipients (recipients and author of parent message)
|
||||
partner_ids = set(kwargs.pop('partner_ids', []))
|
||||
# + legacy-code management (! we manage only 4 and 6 commands)
|
||||
partner_ids = set()
|
||||
kwargs_partner_ids = set(kwargs.pop('partner_ids', []))
|
||||
for partner_id in kwargs_partner_ids:
|
||||
if isinstance(partner_id, (list, tuple)) and partner_id[0] == 4 and len(partner_id) == 2:
|
||||
partner_ids.add(partner_id[1])
|
||||
if isinstance(partner_id, (list, tuple)) and partner_id[0] == 6 and len(partner_id) == 3:
|
||||
partner_ids |= partner_id[2]
|
||||
elif isinstance(partner_id, (int, long)):
|
||||
partner_ids.add(partner_id)
|
||||
else:
|
||||
pass # we do not manage anything else
|
||||
if parent_id and model == 'mail.thread':
|
||||
parent_message = mail_message.browse(cr, uid, parent_id, context=context)
|
||||
partner_ids |= set([partner.id for partner in parent_message.partner_ids])
|
||||
|
@ -1019,6 +1030,13 @@ class mail_thread(osv.AbstractModel):
|
|||
self.message_subscribe(cr, uid, [thread_id], [message.author_id.id], context=context)
|
||||
return msg_id
|
||||
|
||||
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,
|
||||
context=context, **kwargs)
|
||||
|
||||
#------------------------------------------------------
|
||||
# Followers API
|
||||
#------------------------------------------------------
|
||||
|
|
|
@ -120,6 +120,13 @@ class res_users(osv.Model):
|
|||
partner_id = self._message_post_get_pid(cr, uid, thread_id, context=context)
|
||||
return self.pool.get('res.partner').message_post(cr, uid, partner_id, context=context, **kwargs)
|
||||
|
||||
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_update(self, cr, uid, ids, msg_dict, update_vals=None, context=None):
|
||||
for id in ids:
|
||||
partner_id = self.browse(cr, SUPERUSER_ID, id).partner_id.id
|
||||
|
|
Loading…
Reference in New Issue