[IMP] project_working_time_task_portal: display billable_remaining_hours instead of remaining_hours in project kanban view
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user