From 29caafdf9301fdd5ac03f9cf816117cbdc5f50af Mon Sep 17 00:00:00 2001 From: ravb-odoo Date: Fri, 3 Nov 2023 05:04:25 +0000 Subject: [PATCH] [FIX] project: fix allocate hour of sub-tasks issue Description of the issue/feature this PR addresses: in project task form, allocated time of parent task. The 'incl. x on sub-tasks' field is taking allocated time of all the child task as well as sub-tasks of its child task. Field should only take into account time allocated to the first level of sub-tasks. Current behavior before PR: field shows allocated hours of child task as well as sub-task of child-tasks. Desired behavior after PR is merged: field shows allocated hours of only child-tasks. Fix: removed child_task.subtask_planned_hour from the compute method of subtask_planned_hour fields so that its only add the hours of its child-tasks and not its sub-task of child-tasks. task-3277977 closes odoo/odoo#140989 X-original-commit: f42cfb351a86f8ec551066d71271b97a56ce92b4 Signed-off-by: Xavier Bol (xbo) --- addons/project/models/project_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/models/project_task.py b/addons/project/models/project_task.py index 990f04faed7..5ee94a979e0 100644 --- a/addons/project/models/project_task.py +++ b/addons/project/models/project_task.py @@ -504,7 +504,7 @@ class Task(models.Model): @api.depends('child_ids.allocated_hours') def _compute_subtask_allocated_hours(self): for task in self: - task.subtask_allocated_hours = sum(child_task.allocated_hours + child_task.subtask_allocated_hours for child_task in task.child_ids) + task.subtask_allocated_hours = sum(task.child_ids.mapped('allocated_hours')) @api.depends('child_ids') def _compute_subtask_count(self):