Browse Source

[FIX] Bug Fixed 'project_task_timer'

pull/129/head
Ajmalcybrosys 6 years ago
parent
commit
9a53112e03
  1. 2
      project_task_timer/__manifest__.py
  2. 4
      project_task_timer/doc/RELEASE_NOTES.md
  3. 14
      project_task_timer/models/project_task_timer.py

2
project_task_timer/__manifest__.py

@ -19,7 +19,7 @@
############################################################################## ##############################################################################
{ {
'name': 'Project Task Timer', 'name': 'Project Task Timer',
'version': '12.0.2.0.2', 'version': '12.0.2.0.3',
'summary': """Task Timer With Start & Stop""", 'summary': """Task Timer With Start & Stop""",
'description': """"This module helps you to track time sheet in project automatically.""", 'description': """"This module helps you to track time sheet in project automatically.""",
'category': 'Project', 'category': 'Project',

4
project_task_timer/doc/RELEASE_NOTES.md

@ -16,3 +16,7 @@ Bug Fixed
#### 06.11.2019 #### 06.11.2019
#### Version 12.0.2.0.2 #### Version 12.0.2.0.2
Bug Fixed Bug Fixed
#### 12.11.2019
#### Version 12.0.2.0.3
Bug Fixed

14
project_task_timer/models/project_task_timer.py

@ -55,16 +55,13 @@ class ProjectTaskTimer(models.Model):
def toggle_start(self): def toggle_start(self):
for record in self: for record in self:
record.task_timer = not record.task_timer record.task_timer = not record.task_timer
project_obj = self.env['project.task'].search([]) project_obj = self.env['project.task'].search_count(
for data in project_obj: [('user_id', '=', record.user_id.id), ('task_timer', '=', True)])
if self.task_timer: if project_obj > 1:
if data.user_id.id == self.user_id.id and data.task_timer == False: raise UserError(_('you cannot start timer for more than one task at the same time'))
print("success") if record.task_timer:
raise UserError(_('you cannot start timer for more than one task at the same time'))
elif self.task_timer:
self.write({'is_user_working': True}) self.write({'is_user_working': True})
time_line = self.env['account.analytic.line'] time_line = self.env['account.analytic.line']
print(time_line, "time_line")
for time_sheet in self: for time_sheet in self:
time_line.create({ time_line.create({
'name': self.env.user.name + ':' + time_sheet.name, 'name': self.env.user.name + ':' + time_sheet.name,
@ -73,7 +70,6 @@ class ProjectTaskTimer(models.Model):
'project_id': time_sheet.project_id.id, 'project_id': time_sheet.project_id.id,
'date_start': datetime.now(), 'date_start': datetime.now(),
}) })
break
else: else:
self.write({'is_user_working': False}) self.write({'is_user_working': False})
time_line_obj = self.env['account.analytic.line'] time_line_obj = self.env['account.analytic.line']

Loading…
Cancel
Save