diff --git a/addons/hr_timesheet/models/project.py b/addons/hr_timesheet/models/project.py index 0ee5fd58103..686acad3409 100644 --- a/addons/hr_timesheet/models/project.py +++ b/addons/hr_timesheet/models/project.py @@ -142,24 +142,27 @@ class Task(models.Model): @api.depends('display_timesheet_timer', 'timer_start', 'timer_pause', 'total_hours_spent') def _compute_display_timer_buttons(self): for task in self: - displays = super()._compute_display_timer_buttons() - start_p, start_s, stop, pause, resume = displays['start_p'], displays['start_p'], displays['stop'], displays['pause'], displays['resume'] if not task.display_timesheet_timer: - start_p, start_s, stop, pause, resume = False, False, False, False, False + task.update({ + 'display_timer_start_primary': False, + 'display_timer_start_secondary': False, + 'display_timer_stop': False, + 'display_timer_pause': False, + 'display_timer_resume': False, + }) else: + super(Task, task)._compute_display_timer_buttons() + task.display_timer_start_secondary = task.display_timer_start_primary if not task.timer_start: - stop, pause, resume = False, False, False + task.update({ + 'display_timer_stop': False, + 'display_timer_pause': False, + 'display_timer_resume': False, + }) if not task.total_hours_spent: - start_s = False + task.display_timer_start_secondary = False else: - start_p = False - task.write({ - 'display_timer_start_primary': start_p, - 'display_timer_start_secondary': start_s, - 'display_timer_stop': stop, - 'display_timer_pause': pause, - 'display_timer_resume': resume, - }) + task.display_timer_start_primary = False @api.depends('project_id.analytic_account_id.active') def _compute_analytic_account_active(self): diff --git a/addons/timer/models/timer_mixin.py b/addons/timer/models/timer_mixin.py index 201628a16af..4c39587641c 100644 --- a/addons/timer/models/timer_mixin.py +++ b/addons/timer/models/timer_mixin.py @@ -119,13 +119,12 @@ class TimerMixin(models.AbstractModel): pause = False else: resume = False - record.write({ + record.update({ 'display_timer_start_primary': start_p, 'display_timer_stop': stop, 'display_timer_pause': pause, 'display_timer_resume': resume, }) - return {'start_p': start_p, 'stop': stop, 'pause': pause, 'resume': resume} @api.model def _timer_rounding(self, minutes_spent, minimum, rounding):