[IMP] project_working_time_task: display total billable and non billable hours on task
This commit is contained in:
@@ -45,6 +45,20 @@ class Task(models.Model):
|
||||
recursive=True,
|
||||
)
|
||||
|
||||
total_billable_hours_spent = fields.Float(
|
||||
"Total Billable Hours",
|
||||
compute="_compute_total_billable_hours_spent",
|
||||
store=True,
|
||||
help="Billable time spent on this task and its sub-tasks (and their own sub-tasks).",
|
||||
)
|
||||
|
||||
total_non_billable_hours_spent = fields.Float(
|
||||
"Total Non Billable Hours",
|
||||
compute="_compute_total_non_billable_hours_spent",
|
||||
store=True,
|
||||
help="Non billable time spent on this task and its sub-tasks (and their own sub-tasks).",
|
||||
)
|
||||
|
||||
@api.depends('timesheet_ids.unit_amount')
|
||||
def _compute_billable_effective_hours(self):
|
||||
if not any(self._ids):
|
||||
@@ -94,3 +108,17 @@ class Task(models.Model):
|
||||
task.billable_progress = round(100.0 * task_total_hours / task.planned_hours, 2)
|
||||
else:
|
||||
task.billable_progress = 0.0
|
||||
|
||||
@api.depends('billable_effective_hours', 'subtask_billable_effective_hours')
|
||||
def _compute_total_billable_hours_spent(self):
|
||||
for task in self:
|
||||
task.total_billable_hours_spent = (
|
||||
task.billable_effective_hours + task.subtask_billable_effective_hours
|
||||
)
|
||||
|
||||
@api.depends("non_billable_effective_hours", "subtask_non_billable_effective_hours")
|
||||
def _compute_total_non_billable_hours_spent(self):
|
||||
for task in self:
|
||||
task.total_non_billable_hours_spent = (
|
||||
task.non_billable_effective_hours + task.subtask_non_billable_effective_hours
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user