summaryrefslogtreecommitdiff
path: root/addons/hr_timesheet
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2020-06-23 13:44:02 +0000
committerVictor Feyens <vfe@odoo.com>2020-06-23 13:47:32 +0000
commit9d2e60aa86a0e057a12e51b8629c2babaf39f508 (patch)
treebced95419ebc9e1c7f05e7d32cb4c05a15c5fdf6 /addons/hr_timesheet
parent770494fade00c1b6502fef8039928b8aee9a930b (diff)
[FIX] hr_timesheet: wrongly raised UserError
Do not say that the task has timesheets linked when there are none linked...
Diffstat (limited to 'addons/hr_timesheet')
-rw-r--r--addons/hr_timesheet/models/project.py2
1 files changed, 1 insertions, 1 deletions
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)