Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Task Logs

Entity: project.project

Compute Method: _compute_remaining_hours

Inputs Method Outputs
timesheets_read_group = self.env['account.analytic.line']._read_group(
            [('project_id', 'in', self.ids)],
            ['project_id'],
            ['unit_amount:sum'],
        )
timesheet_time_dict = {project.id: unit_amount_sum for project, unit_amount_sum in timesheets_read_group}
for project in self:
            project.effective_hours = round(timesheet_time_dict.get(project.id, 0.0), 2)
            project.remaining_hours = project.allocated_hours - project.effective_hours
            project.is_project_overtime = project.remaining_hours < 0

Back to entity