Skip to content

Commit

Permalink
[FIX] project_timesheet_holidays: Allow HR Officers to generate times…
Browse files Browse the repository at this point in the history
…heets

Purpose
=======

Steps to reproduce:

- Log in as admin
- Make demo user 'Leaves Manager' in Settings/Users.
- Log out and log in again as demo
- Go to Leaves/Leaves to approve/Leaves
- Select Pieter Parker's leave request and click 'Approve'.

Current behavior:
Access error occurs due to security restrictions on Analytic Line,
Operation: write

Expected behavior:
The leave request should be approved as the Leaves Manager should have
permission to approve leave.

Closes #25114

closes #42794

X-original-commit: 78c984b
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
  • Loading branch information
tivisse committed Jan 6, 2020
1 parent d6a36e2 commit 0755be9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/project_timesheet_holidays/models/hr_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _validate_leave_request(self):

work_hours_data = [item for item in holiday.employee_id.iter_work_hours_count(fields.Datetime.from_string(holiday.date_from), fields.Datetime.from_string(holiday.date_to))]
for index, (day_date, work_hours_count) in enumerate(work_hours_data):
self.env['account.analytic.line'].create({
self.env['account.analytic.line'].sudo().create({
'name': "%s (%s/%s)" % (holiday.name or '', index + 1, len(work_hours_data)),
'project_id': holiday_project.id,
'task_id': holiday_task.id,
Expand Down

0 comments on commit 0755be9

Please sign in to comment.