[FIX] fetchmail: fixed message_process on res.users; now having a message_subscribe method, because of automatic subscription of recognized partners on the document; fixed override of message_post in res_partner, using a wrong type variiable; fixed message_post_user_api giving a set instead of a list.
bzr revid: tde@openerp.com-20130103130457-hr1gpj2nj6mp83he
This commit is contained in:
parent
639ae84ff2
commit
4630af9750
|
@ -961,7 +961,7 @@ class mail_thread(osv.AbstractModel):
|
|||
# 3. Post message
|
||||
return self.message_post(cr, uid, thread_id=thread_id, body=body,
|
||||
type=msg_type, subtype=msg_subtype, parent_id=parent_id,
|
||||
attachment_ids=attachment_ids, partner_ids=partner_ids, context=context, **kwargs)
|
||||
attachment_ids=attachment_ids, partner_ids=list(partner_ids), context=context, **kwargs)
|
||||
|
||||
#------------------------------------------------------
|
||||
# Followers API
|
||||
|
|
|
@ -51,9 +51,9 @@ class res_partner_mail(osv.Model):
|
|||
"""
|
||||
if isinstance(thread_id, (list, tuple)):
|
||||
thread_id = thread_id[0]
|
||||
if type == 'email':
|
||||
if kwargs.get('type') == 'email':
|
||||
partner_ids = kwargs.get('partner_ids', [])
|
||||
if thread_id not in partner_ids:
|
||||
if thread_id not in [command[1] for command in partner_ids]:
|
||||
partner_ids.append((4, thread_id))
|
||||
kwargs['partner_ids'] = partner_ids
|
||||
thread_id = False
|
||||
|
|
|
@ -122,7 +122,7 @@ class res_users(osv.Model):
|
|||
context['thread_model'] = 'res.partner'
|
||||
if isinstance(thread_id, (list, tuple)):
|
||||
thread_id = thread_id[0]
|
||||
return self.browse(cr, uid, thread_id).partner_id.id
|
||||
return self.browse(cr, SUPERUSER_ID, thread_id).partner_id.id
|
||||
|
||||
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.
|
||||
|
@ -139,9 +139,16 @@ class res_users(osv.Model):
|
|||
return self.pool.get('res.partner').message_post(cr, uid, partner_id, context=context, **kwargs)
|
||||
|
||||
def message_update(self, cr, uid, ids, msg_dict, update_vals=None, context=None):
|
||||
partner_id = self.browse(cr, uid, ids)[0].partner_id.id
|
||||
return self.pool.get('res.partner').message_update(cr, uid, [partner_id], msg_dict,
|
||||
update_vals=update_vals, context=context)
|
||||
for id in ids:
|
||||
partner_id = self.browse(cr, SUPERUSER_ID, id).partner_id.id
|
||||
self.pool.get('res.partner').message_update(cr, uid, [partner_id], msg_dict, update_vals=update_vals, context=context)
|
||||
return True
|
||||
|
||||
def message_subscribe(self, cr, uid, ids, partner_ids, subtype_ids=None, context=None):
|
||||
for id in ids:
|
||||
partner_id = self.browse(cr, SUPERUSER_ID, id).partner_id.id
|
||||
self.pool.get('res.partner').message_subscribe(cr, uid, [partner_id], partner_ids, subtype_ids=subtype_ids, context=context)
|
||||
return True
|
||||
|
||||
|
||||
class res_users_mail_group(osv.Model):
|
||||
|
|
Loading…
Reference in New Issue