[FIX] project: count all active tasks instead of open tasks in project

Before this commit, the task_count field displayed in the 'Tasks'
stat button shows the number of open tasks, that is all tasks with
either no stage linked or stage not folded or not closed.
The problem is when the user clicks on this stat button (displayed in
project form view or in project update), he sees all active tasks in
the project.

This commit changes the count to display the number of active tasks
instead of the number of open tasks in the project.

task-2633229

closes #76167

X-original-commit: f6ace36d7f61c005f324559d02436f7ff69eb40a
Part-of: odoo/odoo#76263
This commit is contained in:
Xavier BOL (xbo)
2021-09-10 13:41:51 +00:00
parent 59dc90ce16
commit 58195290cc
+1 -3
View File
@@ -161,10 +161,8 @@ class Project(models.Model):
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)],
('stage_id', '=', False)],
['project_id', 'display_project_id:count'], ['project_id'])
result_wo_subtask = defaultdict(int)
result_with_subtasks = defaultdict(int)