[FIX] hr_timesheet: search on remaining hours

Changing mind: it is better to search on remaining
hours of a task, than to make it editable.
So, we got special authorization to restore
this field, and make the world better.
This commit is contained in:
jem-odoo
2018-08-03 16:30:20 +02:00
parent a465802b98
commit fa618fcdd9
+1 -6
View File
@@ -96,7 +96,7 @@ class Task(models.Model):
analytic_account_id = fields.Many2one('account.analytic.account', string="Analytic Account", related='project_id.analytic_account_id', readonly=True)
allow_timesheets = fields.Boolean("Allow timesheets", compute='_compute_allow_timesheets', help="Timesheets can be logged on this task.")
remaining_hours = fields.Float("Remaining Hours", compute='_compute_remaining_hours', inverse='_inverse_remaining_hours', help="Total remaining time, can be re-estimated periodically by the assignee of the task.")
remaining_hours = fields.Float("Remaining Hours", compute='_compute_remaining_hours', store=True, readonly=True, help="Total remaining time, can be re-estimated periodically by the assignee of the task.")
effective_hours = fields.Float("Hours Spent", compute='_compute_effective_hours', compute_sudo=True, store=True, help="Computed using the sum of the task work done.")
total_hours_spent = fields.Float("Total Hours", compute='_compute_total_hours_spent', store=True, help="Computed as: Time Spent + Sub-tasks Hours.")
progress = fields.Float("Progress", compute='_compute_progress_hours', store=True, group_operator="avg", help="Display progress of current task.")
@@ -130,11 +130,6 @@ class Task(models.Model):
for task in self:
task.remaining_hours = task.planned_hours - task.effective_hours - task.subtask_effective_hours
@api.onchange('remaining_hours')
def _inverse_remaining_hours(self):
for task in self:
task.planned_hours = task.remaining_hours + task.effective_hours + task.subtask_effective_hours
@api.depends('effective_hours', 'subtask_effective_hours')
def _compute_total_hours_spent(self):
for task in self: