[FIX] hr_holidays: Allow Team leader to approve

Currently, a Team leader can't approve a leave of an employee
in his team if the leave type requires an allocation.

The reason is the `ir.rule` for `base.group_user` restricting allocation
read access to only your own allocation (`[('employee_id.user_id', '=', user.id)]`)
There are no `ir.rule` for group Team leader.
Therefore, a team leader can't read allocations for his team members.

Fix: add an `ir.rule` to allow a team leader to read allocations
of employees in his team.

+ add associated tests
This commit is contained in:
Lucas Lefèvre
2019-03-19 09:35:31 +01:00
committed by Yannick Tivisse
parent f1fca6dc81
commit aec13abc18
@@ -368,7 +368,7 @@ class TestLeavesRights(TestHrHolidaysBase):
@mute_logger('odoo.models.unlink', 'odoo.addons.mail.models.mail_mail')
def test_leave_validation_team_leader_other(self):
""" Team Leader validates its employee's leave only"""
""" Team Leader validates its employee's allocations only"""
self.leave_type.write({'allocation_type': 'fixed'})
self.env['hr.leave.allocation'].create({
'holiday_status_id': self.leave_type.id,
@@ -380,7 +380,7 @@ class TestLeavesRights(TestHrHolidaysBase):
@mute_logger('odoo.models.unlink', 'odoo.addons.mail.models.mail_mail')
def test_leave_validation_team_leader(self):
""" Team Leader validates its employee's leave"""
""" Team Leader validates its employee's allocations"""
self.leave_type.write({'allocation_type': 'fixed'})
# set the team leader