Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Project
Entity: project.task
Compute Method: _compute_subtask_count
| Inputs | Method | Outputs |
|---|---|---|
|
+ if not any(self._ids): + for task in self: + task.subtask_count, task.closed_subtask_count = len(task.child_ids), len(task.child_ids.filtered(lambda r: r.state in CLOSED_STATES)) + return total_and_closed_subtask_count_per_parent_id = { parent.id: (count, sum(s in CLOSED_STATES for s in states)) for parent, states, count in self.env['project.task']._read_group( - [('parent_id', 'in', self.ids)], + [ + ('parent_id', 'in', self.ids), + '|', + ('parent_id.is_template', '=', True), + ('is_template', '=', False), + ], ['parent_id'], ['state:array_agg', '__count'], ) } for task in self: task.subtask_count, task.closed_subtask_count = total_and_closed_subtask_count_per_parent_id.get(task.id, (0, 0)) |
|
