Skip to content

Commit 188a3fe

Browse files
committed
[FIX] hr: correctly remove m2o link between user and employee
Currently, a user needs to be time off, expense and timesheet approver of an employee for those links to be removed by the departure wizard. If not all the approver fields are the same user, that link will not be removed. Steps to reproduce: - Set Marc Demo as only Time Off approver on an employee. - Archive Marc Demo's employee (This does not remove time off approver from the previous employee) To rectify this issue, we correctly group the `user_domain` so that their contents are properly OR'd. closes odoo#217680 X-original-commit: 1b65d85 Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com> Signed-off-by: Simon Goffaux (sigo) <sigo@odoo.com>
1 parent 6deba5e commit 188a3fe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

addons/hr/models/hr_employee.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def toggle_active(self):
494494
employee_fields_to_empty = self._get_employee_m2o_to_empty_on_archived_employees()
495495
user_fields_to_empty = self._get_user_m2o_to_empty_on_archived_employees()
496496
employee_domain = [[(field, 'in', archived_employees.ids)] for field in employee_fields_to_empty]
497-
user_domain = [[(field, 'in', archived_employees.user_id.ids) for field in user_fields_to_empty]]
497+
user_domain = [[(field, 'in', archived_employees.user_id.ids)] for field in user_fields_to_empty]
498498
employees = self.env['hr.employee'].search(expression.OR(employee_domain + user_domain))
499499
for employee in employees:
500500
for field in employee_fields_to_empty:

0 commit comments

Comments
 (0)