diff options
| author | Goffin Simon <sig@odoo.com> | 2019-06-19 08:50:24 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2019-06-19 09:14:47 +0000 |
| commit | cfd5c90652026ae5d693404a1acec452a228da28 (patch) | |
| tree | 8cb803abe6e2b5606b53603c660a5bbdf7cd4fe9 | |
| parent | 97cd3dfdf99bbee8757a5c63f63ae87c210c6e67 (diff) | |
[FIX] hr_holidays: Access error when requesting a new leave
Steps to reproduce the bug:
- Create an hr.leave.allocation with mode = 'By Employee Tag'
- Select Employee Tag = 'Employee'
- Set all the other required values
- Log with Demo User(Marc Demo)
- Go to Leaves > My Leaves > New Request
Bug:
An access right error was raised due to the record rule: "Allocations: employee: read own"
With this record rule the user can only read the hr.leave.allocation linked to his employee's user.
But with allocations in mode 'By Employee Tag', in the function get_days it tried to compute
the 'number_of_hours_display' of all the allocations linked to the current employee's user and
in the function _compute_number_of_hours_display, it also computes the parent_id of these allocations.
As the parent_id is not linked to the employee's user, it raised an access right error.
opw:2006686
closes odoo/odoo#34236
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
| -rw-r--r-- | addons/hr_holidays/models/hr_leave_type.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/hr_holidays/models/hr_leave_type.py b/addons/hr_holidays/models/hr_leave_type.py index bee9a4939fd..109c624c226 100644 --- a/addons/hr_holidays/models/hr_leave_type.py +++ b/addons/hr_holidays/models/hr_leave_type.py @@ -173,7 +173,7 @@ class HolidaysType(models.Model): if request.leave_type_request_unit == 'hour' else request.number_of_days) - for allocation in allocations: + for allocation in allocations.sudo(): status_dict = result[allocation.holiday_status_id.id] if allocation.state == 'validate': # note: add only validated allocation even for the virtual |
