Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions project_task_timer/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

Project Task Timer
==================
This module helps you to track time sheet in project automatically.

Configuration
=============
No additional configuration required

Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__

License
-------
GNU Affero General Public License v3.0 (AGPL v3)
(http://www.gnu.org/licenses/agpl-3.0-standalone.html)

Credits
-------
Developer: (v10)Jesni Banu, Contact: odoo@cybrosys.com
(v11)Kavya Raveendran, Contact: odoo@cybrosys.com
(v12)Kavya Raveendran, Contact: odoo@cybrosys.com
(v13)Sreejith sasidharan, Contact: odoo@cybrosys.com
(v14)Minhaj T, Contact: odoo@cybrosys.com
(v15)Minhaj T, Contact: odoo@cybrosys.com
(v16)Athira P S , Contact: odoo@cybrosys.com
(v17) Ranjith R, Contact: odoo@cybrosys.com

Contacts
--------
* Mail Contact : odoo@cybrosys.com
* Website : https://cybrosys.com

Bug Tracker
-----------
Bugs are tracked on GitHub Issues. In case of trouble, please check there if
your issue has already been reported.

Maintainer
==========
.. image:: https://cybrosys.com/images/logo.png
:target: https://cybrosys.com

This module is maintained by Cybrosys Technologies.

For support and more information, please visit `Our Website <https://cybrosys.com/>`__

Further information
===================
HTML Description: `<static/description/index.html>`__
22 changes: 22 additions & 0 deletions project_task_timer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Ranjith R (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import models
48 changes: 48 additions & 0 deletions project_task_timer/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Ranjith R (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
{
'name': 'Project Task Timer',
'version': '18.0.1.0.0',
'category': 'Project',
'summary': """Task Timer With Start & Stop""",
'description': """This module helps you to track time sheet in project
automatically.""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': "http://www.cybrosys.com",
'depends': ['project', 'hr_timesheet'],
'data': [
'views/project_task_views.xml',
],
'assets': {
'web.assets_backend': [
'project_task_timer/static/src/css/style.css',
'project_task_timer/static/src/js/timer.js',
'project_task_timer/static/src/xml/timer.xml',
]},
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}
6 changes: 6 additions & 0 deletions project_task_timer/doc/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Module <project_task_timer>

#### 04.03.2024
#### Version 17.0.1.0.0
##### ADD
- Initial Commit for Project Task Timer
23 changes: 23 additions & 0 deletions project_task_timer/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Ranjith R (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import project_task
from . import account_analytic_line
37 changes: 37 additions & 0 deletions project_task_timer/models/account_analytic_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Ranjith R (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from odoo import fields, models


class AccountAnalyticLine(models.Model):
"""Extending account analytic line for project task time tracking."""
_inherit = 'account.analytic.line'

date_start = fields.Datetime(string='Start Date',
help="Start date and time for the task.")
date_end = fields.Datetime(string='End Date', readonly=True,
help="End date and time for the task.")
timer_duration = fields.Float(invisible=1, string='Time Duration (Minutes)',
help="Duration of the timer in minutes.")
using_timer = fields.Boolean(string='Timer Used',
help="Signifies whether the the timesheet"
" created using timer")
109 changes: 109 additions & 0 deletions project_task_timer/models/project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Ranjith R (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from datetime import datetime
from odoo import api, fields, models


class ProjectTask(models.Model):
"""Extending project task for additional timer functionality."""
_inherit = 'project.task'

task_timer = fields.Boolean(
string='Timer', default=False,
help="Field to indicate if the timer is active.")
is_user_working = fields.Boolean(
string='Is Current User Working', compute='_compute_is_user_working',
help="Technical field indicating whether the current user is working.")
duration = fields.Float(
string='Real Duration', store=True, readonly=False,
help="The actual duration of the project task.")
timer_user_id = fields.Many2one('res.users', string="Timer User")
show_timer = fields.Boolean(string="Timer", compute='_compute_show_timer',
help="Indicates whether the timer should be"
" shown for the current user.")

@api.depends('timer_user_id')
def _compute_show_timer(self):
"""Compute the value of the show_timer field based on the
timer_user_id."""
for rec in self:
if rec.timer_user_id:
rec.show_timer = self.env.user.id == rec.timer_user_id.id
else:
rec.show_timer = True

def _compute_is_user_working(self):
""" Compute if the current user is working on the task """
for order in self:
if order.timesheet_ids.filtered(
lambda x: (x.user_id.id == self.env.user.id) and (
not x.date_end)):
order.is_user_working = True
else:
order.is_user_working = False

def action_toggle_start(self, timer):
""" Toggle the timer based on the given parameter """
if timer:
self.write({'is_user_working': True, 'task_timer': True,
'timer_user_id': self.env.user.id})
time_line = self.env['account.analytic.line']
for time_sheet in self:
time_line.create({
'name': self.env.user.name + ': ' + time_sheet.name,
'task_id': time_sheet.id,
'user_id': self.env.user.id,
'project_id': time_sheet.project_id.id,
'using_timer': True,
'date_start': fields.Datetime.now(),
})
else:
self.write({'is_user_working': False, 'task_timer': False,
'timer_user_id': False})
time_line_obj = self.env['account.analytic.line']
domain = [('task_id', 'in', self.ids), ('date_end', '=', False),
('user_id', '=', self.env.user.id)]
for time_line in time_line_obj.search(domain):
if time_line.date_start:
time_line.write({'date_end': fields.Datetime.now()})
diff = fields.Datetime.from_string(
time_line.date_end) - fields.Datetime.from_string(
time_line.date_start)
time_line.timer_duration = round(
diff.total_seconds() / 60.0, 2)
time_line.unit_amount = round(
diff.total_seconds() / (60.0 * 60.0), 2)

def get_working_duration(self):
"""Get the additional duration for 'open times' i.e. productivity
lines with no date_end."""
self.ensure_one()
duration = 0
for time in self.timesheet_ids.filtered(
lambda time: not time.date_end and time.using_timer):
if type(time.date_start) != datetime:
time.date_start = datetime.now()
duration = 0
else:
duration += ((datetime.now() - time.date_start).total_seconds()
/ 60)
return duration
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions project_task_timer/static/description/assets/misc/email.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions project_task_timer/static/description/assets/misc/phone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading