From adc4eb0af359d93fec73e0487d33e0fcd1a21345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Mon, 11 Mar 2019 15:39:23 +0100 Subject: [PATCH] [FIX] project_timesheet_holidays: Fix leave validation rights issues Currently, when a leave is validated, an `account.analytic.line` is automatically created. However, the approver may not have the access rights to do so. This commit fixes the issues by using sudo to generate the line. --- addons/project_timesheet_holidays/models/hr_holidays.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_timesheet_holidays/models/hr_holidays.py b/addons/project_timesheet_holidays/models/hr_holidays.py index c1463b49a27..3671df364e0 100644 --- a/addons/project_timesheet_holidays/models/hr_holidays.py +++ b/addons/project_timesheet_holidays/models/hr_holidays.py @@ -73,7 +73,7 @@ class Holidays(models.Model): 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,