From 0113d989a8ea6241c03466d099feaef8f0c7daa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 29 Aug 2018 11:56:18 +0200 Subject: [PATCH] [REV] hr_holidays: revert "[FIX] hr_holidays: officers can CRUD leaves for their companies" This commit was not correct and was a quick fix to avoid blocking daily use of odoo saas-11.3. Next commit will fix access rights and enforce their definition through more detailed tests. This reverts commit ae34db3221267311a012ed567dadbb1bb0ab88b7. This commit is linked to task ID 1876795 and PR #26656 . --- 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 23baa422cd8..b112c02b2df 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 ['manager', 'both']) and (manager and manager != current_employee)\ + if (validation_type in ['hr', '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 af0e4126893..5b5c4eeb8da 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.company_id', 'child_of', user.company_id.id)] + ['|','|','|', ('employee_id.user_id', '=', user.id), ('department_id', '=', False), ('department_id.manager_id', '=', False), ('department_id.manager_id.user_id', '=', user.id)]