+ def message_post(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.
+ We therefore post on the user and redirect on its partner. """
+ assert thread_id, "res.users does not support posting global messages"
+ if context and 'thread_model' in context:
+ context['thread_model'] = 'res.partner'
+ if isinstance(thread_id, (list, tuple)):
+ thread_id = thread_id[0]
+ partner_id = self.pool.get('res.users').read(cr, uid, thread_id, ['partner_id'], context=context)['partner_id'][0]
+ return self.pool.get('res.partner').message_post(cr, uid, partner_id, context=context, **kwargs)
+