summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2018-08-29 11:56:18 +0200
committerThibault Delavallée <tde@odoo.com>2018-08-31 14:19:23 +0200
commit0113d989a8ea6241c03466d099feaef8f0c7daa3 (patch)
treed53bb087f0577193e6ba16006e7e753d67332a67
parente886c2edd3b5fa74444d290367b646f03a92de12 (diff)
[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 .
-rw-r--r--addons/hr_holidays/models/hr_leave.py2
-rw-r--r--addons/hr_holidays/security/hr_holidays_security.xml2
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 @@
<record id="hr_leave_rule_officer" model="ir.rule">
<field name="name">Leaves Officer</field>
<field name="model_id" ref="model_hr_leave"/>
- <field name="domain_force">[('employee_id.company_id', 'child_of', user.company_id.id)]</field>
+ <field name="domain_force">['|','|','|', ('employee_id.user_id', '=', user.id), ('department_id', '=', False), ('department_id.manager_id', '=', False), ('department_id.manager_id.user_id', '=', user.id)]</field>
<field name="groups" eval="[(4,ref('hr_holidays.group_hr_holidays_user'))]"/>
</record>