[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) <xbo@odoo.com>
This commit is contained in:
ravb-odoo
2023-11-06 11:16:44 +00:00
parent 4ec329d26f
commit 29caafdf93
+1 -1
View File
@@ -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):