[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.
This commit is contained in:
committed by
Yannick Tivisse
parent
b1c4f4058e
commit
adc4eb0af3
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user