[IMP] hr_timesheet: unset the task_id when the project changed
Before this commit, when the project of the timesheet changed, the task_id of the timesheet is not unset and so it could have some inconsistency. This commit ensures the task linked to the timesheet has the same project than the one set on the timesheet, otherwise the task_id is unset. part of task-2276015 task-3542388 Part-of: odoo/odoo#137820
This commit is contained in:
@@ -104,7 +104,9 @@ class AccountAnalyticLine(models.Model):
|
||||
|
||||
@api.depends('project_id')
|
||||
def _compute_task_id(self):
|
||||
for line in self.filtered(lambda line: not line.project_id):
|
||||
for line in self:
|
||||
if line.project_id and line.project_id == line.task_id.project_id:
|
||||
continue
|
||||
line.task_id = False
|
||||
|
||||
@api.onchange('project_id')
|
||||
|
||||
Reference in New Issue
Block a user