Skip to content
Snippets Groups Projects
Commit e2f2f2df authored by Michele's avatar Michele
Browse files

[FIX] project_timesheet_holidays: move update check to easily override it


Before this commit, the check is too restricted and it is not possible to update it to add other conditions.

This commit moves that check in a new method to be able to override it.

closes odoo/odoo#120597

Signed-off-by: default avatarXavier Bol (xbo) <xbo@odoo.com>
parent 9c6bac74
Branches
Tags
No related merge requests found
......@@ -27,7 +27,10 @@ class AccountAnalyticLine(models.Model):
raise UserError(_('You cannot create timesheets for a task that is linked to a time off type. Please use the Time Off application to request new time off instead.'))
return super().create(vals_list)
def _check_can_update_timesheet(self):
return self.env.su or not self.filtered('holiday_id')
def write(self, vals):
if not self.env.su and self.filtered('holiday_id'):
if not self._check_can_update_timesheet():
raise UserError(_('You cannot modify timesheets that are linked to time off requests. Please use the Time Off application to modify your time off requests instead.'))
return super().write(vals)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment