From 9d2e60aa86a0e057a12e51b8629c2babaf39f508 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Tue, 23 Jun 2020 13:44:02 +0000 Subject: [PATCH] [FIX] hr_timesheet: wrongly raised UserError Do not say that the task has timesheets linked when there are none linked... --- addons/hr_timesheet/models/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet/models/project.py b/addons/hr_timesheet/models/project.py index 623f0acd55d..5f8651c7faf 100644 --- a/addons/hr_timesheet/models/project.py +++ b/addons/hr_timesheet/models/project.py @@ -170,7 +170,7 @@ class Task(models.Model): def write(self, values): # a timesheet must have an analytic account (and a project) - if 'project_id' in values and self and not values.get('project_id'): + if 'project_id' in values and not values.get('project_id') and self._get_timesheet(): raise UserError(_('This task must be part of a project because there are some timesheets linked to it.')) res = super(Task, self).write(values)