[FIX] project: wrong subtask count

Issue

	- Install "Project" module
	- Active "Sub Task" feature in settings
	- Create a new project `X`
	- Go to settings of project `X` and activate "sub task" feature
	- Add a Task `A` in project `X`
	- Add a subtask `B` to task `A`
	- In menu, click on `Tasks` to list all tasks
	- Edit view and add `subtask_count` field then save

	Wrong value in `subtask_count` field.

Cause

	Retrieving childs of self instead of "current" task (`for task in self:`).

Solution

	Use "current" task instead of self.

opw-2361013

closes odoo/odoo#60230

X-original-commit: c961638d49a392468ac4a521bcb208dd9d68a99d
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nasreddin (bon)
2020-10-19 07:45:47 +00:00
parent b07f2d31d2
commit f224da276c
+1 -1
View File
@@ -936,7 +936,7 @@ class Task(models.Model):
@api.depends('child_ids')
def _compute_subtask_count(self):
for task in self:
task.subtask_count = len(self._get_all_subtasks())
task.subtask_count = len(task._get_all_subtasks())
@api.onchange('company_id')
def _onchange_task_company(self):