Files
odoo_source/addons/hr_timesheet/report/project_report.py
T
jem-odoo d50a1e2622 [IMP] project,hr_timesheet: no 'remaining hours' field in project
'remaining_hours' is defined in project as a simple
float field, manually updateable, only displayed
when the group "Time Estimation on Task" is activated.
But for now, there is no setting to active this group.

Those are legacy useless stuff, so we can remove it.
The purpose is to make 'time estimation' feature only
available when timesheet is installed.

Thie commit also split the compute methods of
'remaining_hours' and 'progress' fields to make
'remaining_hours' updateable, though inverse method.
Without splitting the compute method, the calculation
of the progress was done correctly during onchange
but not when saving.
2018-04-06 14:30:47 +02:00

29 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ReportProjectTaskUser(models.Model):
_inherit = "report.project.task.user"
hours_planned = fields.Float('Planned Hours', readonly=True)
hours_effective = fields.Float('Effective Hours', readonly=True)
remaining_hours = fields.Float('Remaining Hours', readonly=True)
progress = fields.Float('Progress', group_operator='avg', readonly=True)
def _select(self):
return super(ReportProjectTaskUser, self)._select() + """,
progress as progress,
t.effective_hours as hours_effective,
t.planned_hours - t.effective_hours - t.subtask_effective_hours as remaining_hours,
planned_hours as hours_planned"""
def _group_by(self):
return super(ReportProjectTaskUser, self)._group_by() + """,
remaining_hours,
t.effective_hours,
progress,
planned_hours
"""