[FIX] use correct user for work permit expiration reminder

Before this commit:
We use the employee's manager's user's idto fetch a partner by id.
This can cause the action to fail in specific cases as well as
potentially using the wrong language for the reminder

closes odoo/odoo#113282

X-original-commit: c26db495c929d60de62a36cf920c88f6f4c855b9
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Sylvain Francis
2023-02-22 11:42:00 +01:00
parent e520f95868
commit 3642dd2646
+1 -1
View File
@@ -210,7 +210,7 @@ class HrEmployeePrivate(models.Model):
responsible_user_id = employee.parent_id.user_id.id
if responsible_user_id:
employees_scheduled |= employee
lang = self.env['res.partner'].browse(responsible_user_id).lang
lang = self.env['res.users'].browse(responsible_user_id).lang
formated_date = format_date(employee.env, employee.work_permit_expiration_date, date_format="dd MMMM y", lang_code=lang)
employee.activity_schedule(
'mail.mail_activity_data_todo',