Browse Source

[FIX] Bug Fixed 'project_task_timer'

pull/129/head
Ajmalcybrosys 6 years ago
parent
commit
0eb1635162
  1. 2
      project_task_timer/__init__.py
  2. 4
      project_task_timer/__manifest__.py
  3. 4
      project_task_timer/doc/RELEASE_NOTES.md
  4. 2
      project_task_timer/models/__init__.py
  5. 15
      project_task_timer/models/project_task_timer.py

2
project_task_timer/__init__.py

@ -2,7 +2,7 @@
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Copyright (C) 2019-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Jesni Banu(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.

4
project_task_timer/__manifest__.py

@ -2,7 +2,7 @@
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Copyright (C) 2019-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Jesni Banu(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Project Task Timer',
'version': '12.0.2.0',
'version': '12.0.2.0.1',
'summary': """Task Timer With Start & Stop""",
'description': """"This module helps you to track time sheet in project automatically.""",
'category': 'Project',

4
project_task_timer/doc/RELEASE_NOTES.md

@ -8,3 +8,7 @@ Initial Commit for project_task_timer
#### 18.07.2019
#### Version 12.0.2.0
Bug Fixed
#### 06.11.2019
#### Version 12.0.2.0.1
Bug Fixed

2
project_task_timer/models/__init__.py

@ -2,7 +2,7 @@
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Copyright (C) 2019-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Jesni Banu(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.

15
project_task_timer/models/project_task_timer.py

@ -25,7 +25,7 @@ class ProjectTaskTimeSheet(models.Model):
_inherit = 'account.analytic.line'
date_start = fields.Datetime(string='Start Date')
date_end = fields.Datetime(string='End Date', readonly=1)
date_end = fields.Datetime(string='End Date')
timer_duration = fields.Float(invisible=1, string='Time Duration (Minutes)')
@ -52,8 +52,10 @@ class ProjectTaskTimer(models.Model):
for record in self:
record.task_timer = not record.task_timer
if self.task_timer:
print("self.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,
@ -65,18 +67,19 @@ class ProjectTaskTimer(models.Model):
else:
self.write({'is_user_working': False})
time_line_obj = self.env['account.analytic.line']
print(time_line_obj, "time_line_obj")
domain = [('task_id', 'in', self.ids), ('date_end', '=', False)]
for time_line in time_line_obj.search(domain):
print(time_line, "else")
time_line.write({'date_end': fields.Datetime.now()})
if time_line.date_end:
diff = fields.Datetime.from_string(time_line.date_end) - fields.Datetime.from_string(
time_line.date_start)
time_line.date_start)
print(len(time_line) - 1, "time_line - 1")
# if time_line == len(time_line) - 1:
print(len(time_line), "-----------------------")
time_line.timer_duration = round(diff.total_seconds() / 60.0, 2)
time_line.unit_amount = round(diff.total_seconds() / (60.0 * 60.0), 2)
else:
time_line.unit_amount = 0.0
time_line.timer_duration = 0.0

Loading…
Cancel
Save