From 3ce5cbe064e2bc51300edd5febdf86f34dd1380c Mon Sep 17 00:00:00 2001 From: Kartik Chavda Date: Thu, 19 Jan 2023 05:12:13 +0000 Subject: [PATCH] [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) --- addons/project/models/project.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/project/models/project.py b/addons/project/models/project.py index c633dbe13e0..154fde09694 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -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