From b2a34712938ced5ecd9595b93ec0657d4cde10dc Mon Sep 17 00:00:00 2001 From: Nicolas Seinlet Date: Tue, 13 Apr 2021 11:27:49 +0000 Subject: [PATCH] [FIX] project: fix count for task with NULL project_id This commit fixes a regression introduced in #62577 . Tasks are only taken into account iff their project_id is in self.ids. closes odoo/odoo#69303 X-original-commit: 5be4970ddec2d9052d3b044e6e156aef94442c9a Signed-off-by: Yannick Tivisse (yti) --- addons/project/models/project.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/project/models/project.py b/addons/project/models/project.py index cf2e784a455..988d70842f6 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -116,8 +116,14 @@ class Project(models.Model): ]) def _compute_task_count(self): - task_data = self.env['project.task'].read_group(['|', '&', ('stage_id.is_closed', '=', False), ('stage_id.fold', '=', False), ('stage_id', '=', False)], - ['project_id', 'display_project_id:count'], ['project_id']) + task_data = self.env['project.task'].read_group( + [('project_id', 'in', self.ids), + '|', + '&', + ('stage_id.is_closed', '=', False), + ('stage_id.fold', '=', False), + ('stage_id', '=', False)], + ['project_id', 'display_project_id:count'], ['project_id']) result_wo_subtask = defaultdict(int) result_with_subtasks = defaultdict(int) for data in task_data: