[FIX] project: avoid resetting the kanban state in task

Steps:
- Install project app.
- Active Sub-tasks feature in config settings
- Create task with parent task
- Green the kanban state
- Modify the parent task

Issue:
  The kanban state changes when we change the parent task in the task.

Fix:
  We avoid the recomputing kanban state.

Why issue occurred:

  When we change the parent task _compute_project_id is called and sets the project.
  the _compute_kanban_state method depends on the project. So reset the kanban state.

task-3141855

closes odoo/odoo#110492

X-original-commit: 0393cffa71821ba32af8e9ba54225275647c4e70
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Kartik Chavda
2023-01-20 20:58:40 +01:00
committed by Prakash Prajapati
parent b4fdc6c01d
commit 3ce5cbe064
+2
View File
@@ -2180,6 +2180,8 @@ class Task(models.Model):
@api.depends('parent_id.project_id', 'display_project_id')
def _compute_project_id(self):
# Avoid recomputing kanban_state
self.env.remove_to_compute(self._fields['kanban_state'], self)
for task in self:
if task.parent_id:
task.project_id = task.display_project_id or task.parent_id.project_id