[IMP] project_working_time_task_portal: display billable_remaining_hours instead of remaining_hours in project kanban view

This commit is contained in:
2025-08-20 12:44:45 +02:00
parent be81194749
commit 0be0c81375
3 changed files with 39 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
from odoo import models, fields, api, _
from odoo import models, fields, api
from odoo.tools.float_utils import float_compare
@@ -84,4 +84,20 @@ class Task(models.Model):
else:
task.billable_progress = round(100.0 * task_total_hours / task.planned_hours, 2)
else:
task.billable_progress = 0.0
task.billable_progress = 0.0
class Project(models.Model):
_inherit = "project.project"
billable_remaining_hours = fields.Float(
compute="_compute_project_billable_remaining_hours",
string="Billable Remaining Hours",
store=True,
help="Total Billable remaining time (without exclude_from_sale_order timesheet lines)."
)
@api.depends("task_ids.billable_remaining_hours")
def _compute_project_billable_remaining_hours(self):
for project in self:
project.billable_remaining_hours = sum(task.billable_remaining_hours for task in project.task_ids)