diff --git a/project_task_timer/__manifest__.py b/project_task_timer/__manifest__.py index a42cb298a..8984f4347 100644 --- a/project_task_timer/__manifest__.py +++ b/project_task_timer/__manifest__.py @@ -19,7 +19,7 @@ ############################################################################## { 'name': 'Project Task Timer', - 'version': '12.0.2.0.2', + 'version': '12.0.2.0.3', 'summary': """Task Timer With Start & Stop""", 'description': """"This module helps you to track time sheet in project automatically.""", 'category': 'Project', diff --git a/project_task_timer/doc/RELEASE_NOTES.md b/project_task_timer/doc/RELEASE_NOTES.md index 3316a4f7f..a903ec28c 100644 --- a/project_task_timer/doc/RELEASE_NOTES.md +++ b/project_task_timer/doc/RELEASE_NOTES.md @@ -16,3 +16,7 @@ Bug Fixed #### 06.11.2019 #### Version 12.0.2.0.2 Bug Fixed + +#### 12.11.2019 +#### Version 12.0.2.0.3 +Bug Fixed diff --git a/project_task_timer/models/project_task_timer.py b/project_task_timer/models/project_task_timer.py index bbf1f4edb..b5abb0677 100644 --- a/project_task_timer/models/project_task_timer.py +++ b/project_task_timer/models/project_task_timer.py @@ -55,16 +55,13 @@ class ProjectTaskTimer(models.Model): def toggle_start(self): for record in self: record.task_timer = not record.task_timer - project_obj = self.env['project.task'].search([]) - for data in project_obj: - if self.task_timer: - if data.user_id.id == self.user_id.id and data.task_timer == False: - print("success") - raise UserError(_('you cannot start timer for more than one task at the same time')) - elif self.task_timer: + project_obj = self.env['project.task'].search_count( + [('user_id', '=', record.user_id.id), ('task_timer', '=', True)]) + if project_obj > 1: + raise UserError(_('you cannot start timer for more than one task at the same time')) + if record.task_timer: self.write({'is_user_working': True}) time_line = self.env['account.analytic.line'] - print(time_line, "time_line") for time_sheet in self: time_line.create({ 'name': self.env.user.name + ':' + time_sheet.name, @@ -73,7 +70,6 @@ class ProjectTaskTimer(models.Model): 'project_id': time_sheet.project_id.id, 'date_start': datetime.now(), }) - break else: self.write({'is_user_working': False}) time_line_obj = self.env['account.analytic.line']