From ae34db3221267311a012ed567dadbb1bb0ab88b7 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 22 Aug 2018 12:06:28 +0200 Subject: [PATCH] [FIX] hr_holidays: officers can CRUD leaves for their companies Before this, CRUD leaves was limited to department After this, we go back to what was in 11.2: CRUD for the whole company, and children of it OPW 1878869 closes #26516 --- addons/hr_holidays/models/hr_leave.py | 2 +- addons/hr_holidays/security/hr_holidays_security.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py index b112c02b2df..23baa422cd8 100644 --- a/addons/hr_holidays/models/hr_leave.py +++ b/addons/hr_holidays/models/hr_leave.py @@ -411,7 +411,7 @@ class HolidaysRequest(models.Model): for holiday in self: validation_type = holiday.holiday_status_id.validation_type manager = holiday.employee_id.parent_id or holiday.employee_id.department_id.manager_id - if (validation_type in ['hr', 'both']) and (manager and manager != current_employee)\ + if (validation_type in ['manager', 'both']) and (manager and manager != current_employee)\ and not self.env.user.has_group('hr_holidays.group_hr_holidays_manager'): raise UserError(_('You must be %s manager to approve this leave') % (holiday.employee_id.name)) elif validation_type == 'manager' and not self.env.user.has_group('hr_holidays.group_hr_holidays_manager'): diff --git a/addons/hr_holidays/security/hr_holidays_security.xml b/addons/hr_holidays/security/hr_holidays_security.xml index 5b5c4eeb8da..af0e4126893 100644 --- a/addons/hr_holidays/security/hr_holidays_security.xml +++ b/addons/hr_holidays/security/hr_holidays_security.xml @@ -38,7 +38,7 @@ Leaves Officer - ['|','|','|', ('employee_id.user_id', '=', user.id), ('department_id', '=', False), ('department_id.manager_id', '=', False), ('department_id.manager_id.user_id', '=', user.id)] + [('employee_id.company_id', 'child_of', user.company_id.id)]