'Redirect the posting of message on res.users as a private discussion.
This is done because when giving the context of Chatter on the
various mailboxes, we do not have access to the current partner_id.'

@api.multi
@api.returns('self', (lambda value: value.id))
def message_post(self, **kwargs):

    current_pids = []
    partner_ids = kwargs.get('partner_ids', [])
    user_pid = self._message_post_get_pid()
    for partner_id in partner_ids:
        if (isinstance(partner_id, (list, tuple)) and (partner_id[0] == 4) and (len(partner_id) == 2)):
            current_pids.append(partner_id[1])
        elif (isinstance(partner_id, (list, tuple)) and (partner_id[0] == 6) and (len(partner_id) == 3)):
            current_pids.append(partner_id[2])
        elif isinstance(partner_id, (int, long)):
            current_pids.append(partner_id)
    if (user_pid not in current_pids):
        partner_ids.append(user_pid)
    kwargs['partner_ids'] = partner_ids
    return self.env['mail.thread'].message_post(**kwargs)
