summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjem-odoo <jem@openerp.com>2018-08-03 11:43:34 +0200
committerjem-odoo <jem@openerp.com>2018-08-03 16:30:20 +0200
commitfa618fcdd96885e8d1c95e4b00aa99840a58e140 (patch)
tree2dc281b67522795b9a0a63c9c725888e28aa0636
parenta465802b98a31c6d00ef0324f96382bd3c0232a4 (diff)
[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.
-rw-r--r--addons/hr_timesheet/models/project.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/addons/hr_timesheet/models/project.py b/addons/hr_timesheet/models/project.py
index 69d19c4a340..80b79d8e2fa 100644
--- a/addons/hr_timesheet/models/project.py
+++ b/addons/hr_timesheet/models/project.py
@@ -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: