[FIX] hr: employee should be subscribed

The employee should be subscribed to their own record in order to
receive communication send to them.

closes odoo/odoo#112736

Taskid: 2749585
X-original-commit: 43d99b06a792a39aa14b7afb8b48aa79c2da2737
Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Kevin Baptiste
2023-02-15 09:11:32 +01:00
parent 77fcc10bb1
commit 145ecfcc55
+3
View File
@@ -332,6 +332,7 @@ class HrEmployeePrivate(models.Model):
employees = super().create(vals_list)
if self.env.context.get('salary_simulation'):
return employees
employees.message_subscribe(employees.address_home_id.ids)
employee_departments = employees.department_id
if employee_departments:
self.env['mail.channel'].sudo().search([
@@ -359,6 +360,8 @@ class HrEmployeePrivate(models.Model):
account_id = vals.get('bank_account_id') or self.bank_account_id.id
if account_id:
self.env['res.partner.bank'].browse(account_id).partner_id = vals['address_home_id']
self.message_unsubscribe(self.address_home_id.ids)
self.message_subscribe([vals['address_home_id']])
if vals.get('user_id'):
# Update the profile pictures with user, except if provided
vals.update(self._sync_user(self.env['res.users'].browse(vals['user_id']),