[FIX] hr: posting on the user should not fail when it is

not linked to anh employee. In that case, fall back on the previous
behavior that is posting on the partner.

bzr revid: tde@openerp.com-20131217084728-myk234abi9gqwkuq
This commit is contained in:
Thibault Delavallée 2013-12-17 09:47:28 +01:00
parent 89a6771f6a
commit 322e0b9cae
1 changed files with 3 additions and 2 deletions

View File

@ -57,9 +57,10 @@ class res_users(osv.Model):
various mailboxes, we do not have access to the current partner_id. """
if kwargs.get('type') == 'email':
return super(res_users, self).message_post(cr, uid, thread_id, context=context, **kwargs)
res = None
employee_ids = self._message_post_get_eid(cr, uid, thread_id, context=context)
if not employee_ids:
pass # dpo something
if not employee_ids: # no employee: fall back on previous behavior
return super(res_users, self).message_post(cr, uid, thread_id, context=context, **kwargs)
for employee_id in employee_ids:
res = self.pool.get('hr.employee').message_post(cr, uid, employee_id, context=context, **kwargs)
return res