diff --git a/project_task_timer/README.rst b/project_task_timer/README.rst new file mode 100644 index 000000000..53bbe1ab7 --- /dev/null +++ b/project_task_timer/README.rst @@ -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 `__ + +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 `__ + +Further information +=================== +HTML Description: ``__ diff --git a/project_task_timer/__init__.py b/project_task_timer/__init__.py new file mode 100644 index 000000000..03478bd9f --- /dev/null +++ b/project_task_timer/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# 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 . +# +############################################################################### +from . import models diff --git a/project_task_timer/__manifest__.py b/project_task_timer/__manifest__.py new file mode 100644 index 000000000..2293fa0eb --- /dev/null +++ b/project_task_timer/__manifest__.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# 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 . +# +############################################################################### +{ + '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, +} diff --git a/project_task_timer/doc/RELEASE_NOTES.md b/project_task_timer/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..1318c3f9d --- /dev/null +++ b/project_task_timer/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 04.03.2024 +#### Version 17.0.1.0.0 +##### ADD +- Initial Commit for Project Task Timer diff --git a/project_task_timer/models/__init__.py b/project_task_timer/models/__init__.py new file mode 100644 index 000000000..24609dd0e --- /dev/null +++ b/project_task_timer/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# 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 . +# +############################################################################### +from . import project_task +from . import account_analytic_line diff --git a/project_task_timer/models/account_analytic_line.py b/project_task_timer/models/account_analytic_line.py new file mode 100644 index 000000000..b885edfec --- /dev/null +++ b/project_task_timer/models/account_analytic_line.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# 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 . +# +############################################################################### +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") diff --git a/project_task_timer/models/project_task.py b/project_task_timer/models/project_task.py new file mode 100644 index 000000000..f28962dde --- /dev/null +++ b/project_task_timer/models/project_task.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# 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 . +# +############################################################################### +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 diff --git a/project_task_timer/static/description/assets/icons/capture (1).png b/project_task_timer/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/project_task_timer/static/description/assets/icons/capture (1).png differ diff --git a/project_task_timer/static/description/assets/icons/check.png b/project_task_timer/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/project_task_timer/static/description/assets/icons/check.png differ diff --git a/project_task_timer/static/description/assets/icons/chevron.png b/project_task_timer/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/project_task_timer/static/description/assets/icons/chevron.png differ diff --git a/project_task_timer/static/description/assets/icons/cogs.png b/project_task_timer/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/project_task_timer/static/description/assets/icons/cogs.png differ diff --git a/project_task_timer/static/description/assets/icons/consultation.png b/project_task_timer/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/project_task_timer/static/description/assets/icons/consultation.png differ diff --git a/project_task_timer/static/description/assets/icons/ecom-black.png b/project_task_timer/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/project_task_timer/static/description/assets/icons/ecom-black.png differ diff --git a/project_task_timer/static/description/assets/icons/education-black.png b/project_task_timer/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/project_task_timer/static/description/assets/icons/education-black.png differ diff --git a/project_task_timer/static/description/assets/icons/hotel-black.png b/project_task_timer/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/project_task_timer/static/description/assets/icons/hotel-black.png differ diff --git a/project_task_timer/static/description/assets/icons/img.png b/project_task_timer/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/project_task_timer/static/description/assets/icons/img.png differ diff --git a/project_task_timer/static/description/assets/icons/license.png b/project_task_timer/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/project_task_timer/static/description/assets/icons/license.png differ diff --git a/project_task_timer/static/description/assets/icons/lifebuoy.png b/project_task_timer/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/project_task_timer/static/description/assets/icons/lifebuoy.png differ diff --git a/project_task_timer/static/description/assets/icons/manufacturing-black.png b/project_task_timer/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/project_task_timer/static/description/assets/icons/manufacturing-black.png differ diff --git a/project_task_timer/static/description/assets/icons/photo-capture.png b/project_task_timer/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/project_task_timer/static/description/assets/icons/photo-capture.png differ diff --git a/project_task_timer/static/description/assets/icons/pos-black.png b/project_task_timer/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/project_task_timer/static/description/assets/icons/pos-black.png differ diff --git a/project_task_timer/static/description/assets/icons/puzzle.png b/project_task_timer/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/project_task_timer/static/description/assets/icons/puzzle.png differ diff --git a/project_task_timer/static/description/assets/icons/restaurant-black.png b/project_task_timer/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/project_task_timer/static/description/assets/icons/restaurant-black.png differ diff --git a/project_task_timer/static/description/assets/icons/service-black.png b/project_task_timer/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/project_task_timer/static/description/assets/icons/service-black.png differ diff --git a/project_task_timer/static/description/assets/icons/trading-black.png b/project_task_timer/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/project_task_timer/static/description/assets/icons/trading-black.png differ diff --git a/project_task_timer/static/description/assets/icons/training.png b/project_task_timer/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/project_task_timer/static/description/assets/icons/training.png differ diff --git a/project_task_timer/static/description/assets/icons/update.png b/project_task_timer/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/project_task_timer/static/description/assets/icons/update.png differ diff --git a/project_task_timer/static/description/assets/icons/user.png b/project_task_timer/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/project_task_timer/static/description/assets/icons/user.png differ diff --git a/project_task_timer/static/description/assets/icons/wrench.png b/project_task_timer/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/project_task_timer/static/description/assets/icons/wrench.png differ diff --git a/project_task_timer/static/description/assets/misc/Cybrosys R.png b/project_task_timer/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/project_task_timer/static/description/assets/misc/Cybrosys R.png differ diff --git a/project_task_timer/static/description/assets/misc/email.svg b/project_task_timer/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/project_task_timer/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/project_task_timer/static/description/assets/misc/phone.svg b/project_task_timer/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/project_task_timer/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/project_task_timer/static/description/assets/misc/star (1) 2.svg b/project_task_timer/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/project_task_timer/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/project_task_timer/static/description/assets/misc/support (1) 1.svg b/project_task_timer/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/project_task_timer/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/project_task_timer/static/description/assets/misc/support-email.svg b/project_task_timer/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/project_task_timer/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/project_task_timer/static/description/assets/misc/tick-mark.svg b/project_task_timer/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/project_task_timer/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/project_task_timer/static/description/assets/misc/whatsapp 1.svg b/project_task_timer/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/project_task_timer/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/project_task_timer/static/description/assets/misc/whatsapp.svg b/project_task_timer/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/project_task_timer/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/project_task_timer/static/description/assets/modules/1.png b/project_task_timer/static/description/assets/modules/1.png new file mode 100644 index 000000000..ba1058c42 Binary files /dev/null and b/project_task_timer/static/description/assets/modules/1.png differ diff --git a/project_task_timer/static/description/assets/modules/2.png b/project_task_timer/static/description/assets/modules/2.png new file mode 100644 index 000000000..6949185dd Binary files /dev/null and b/project_task_timer/static/description/assets/modules/2.png differ diff --git a/project_task_timer/static/description/assets/modules/3.png b/project_task_timer/static/description/assets/modules/3.png new file mode 100644 index 000000000..4e506f79b Binary files /dev/null and b/project_task_timer/static/description/assets/modules/3.png differ diff --git a/project_task_timer/static/description/assets/modules/4.png b/project_task_timer/static/description/assets/modules/4.png new file mode 100644 index 000000000..e78427938 Binary files /dev/null and b/project_task_timer/static/description/assets/modules/4.png differ diff --git a/project_task_timer/static/description/assets/modules/5.png b/project_task_timer/static/description/assets/modules/5.png new file mode 100644 index 000000000..272ec20f9 Binary files /dev/null and b/project_task_timer/static/description/assets/modules/5.png differ diff --git a/project_task_timer/static/description/assets/modules/6.png b/project_task_timer/static/description/assets/modules/6.png new file mode 100644 index 000000000..7d5c3154f Binary files /dev/null and b/project_task_timer/static/description/assets/modules/6.png differ diff --git a/project_task_timer/static/description/assets/screenshots/1.png b/project_task_timer/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..5f935785f Binary files /dev/null and b/project_task_timer/static/description/assets/screenshots/1.png differ diff --git a/project_task_timer/static/description/assets/screenshots/2.png b/project_task_timer/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..4d6d8352b Binary files /dev/null and b/project_task_timer/static/description/assets/screenshots/2.png differ diff --git a/project_task_timer/static/description/assets/screenshots/3.png b/project_task_timer/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..cccd5498d Binary files /dev/null and b/project_task_timer/static/description/assets/screenshots/3.png differ diff --git a/project_task_timer/static/description/assets/screenshots/4.png b/project_task_timer/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..ae9456dfe Binary files /dev/null and b/project_task_timer/static/description/assets/screenshots/4.png differ diff --git a/project_task_timer/static/description/assets/screenshots/hero.gif b/project_task_timer/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..485742c2e Binary files /dev/null and b/project_task_timer/static/description/assets/screenshots/hero.gif differ diff --git a/project_task_timer/static/description/banner.jpg b/project_task_timer/static/description/banner.jpg new file mode 100644 index 000000000..5c81c3ee1 Binary files /dev/null and b/project_task_timer/static/description/banner.jpg differ diff --git a/project_task_timer/static/description/icon.png b/project_task_timer/static/description/icon.png new file mode 100644 index 000000000..7740297dd Binary files /dev/null and b/project_task_timer/static/description/icon.png differ diff --git a/project_task_timer/static/description/index.html b/project_task_timer/static/description/index.html new file mode 100644 index 000000000..591713597 --- /dev/null +++ b/project_task_timer/static/description/index.html @@ -0,0 +1,721 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+
+
+
+
+

+ Project Task Timer

+

+ This module helps you to track time sheet in project + automatically. +

+
+ +
+
+
+
+
+

+ Key Highlights +

+
+
+
+
+
+ +
+
+

+ Timer in Task.

+

Add Timesheet + for each task. +

+
+
+
+
+
+
+ +
+
+

+ Real Time Work Duration.

+

+ User can see real time duration of work. +

+
+
+
+
+
+
+ +
+
+

+ Automatic Timesheet Calculation.

+

A timesheet is + created + according to the duration of work. +

+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+

+ After installation, + open Project and go to any Task.

+
+
+
+
+
+
+ +
+
+

+ Enable the timer. You can see the timer is + running and a + notification indicating starting of the + timer.

+
+
+
+
+
+
+ +
+
+

+ While disabling the timer, you can see the + automated timesheet + entries.

+
+
+
+
+
+
+ +
+
+

+ At a time only one user can work on the + task. Other users cannot see the toggle + button if any other user is working on the + corresponding task.

+
+
+
+
+
+
+
    +
  • + Timer in Task. +
  • +
  • + Real Time Work + Duration. +
  • +
  • + Automatic + Timesheet Calculation. +
  • + +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:04 th MAR 2024 +
+

+ + Initial Commit for Project Task Timer.

+
+
+
+
+
+
+
+

+ Related Products

+
+
+ +
+
+

+ Our Services

+ +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire + Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo + Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Licensing Consultancy

+
+
+
+
+
+
+

+ Our Industries

+ +
+
+
+
+
+
+ +

Trading

+

Easily procure and sell your products

+
+
+
+
+ +

POS

+

Easy configuration and convivial experience

+
+
+
+
+ +

+ Education

+

A platform for educational management

+
+
+
+
+ +

+ Manufacturing

+

Plan, track and schedule your operations

+
+
+
+
+ +

E-commerce + & + Website

+

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +

Service + Management

+

Keep track of services and invoice

+
+
+
+
+ +

+ Restaurant

+

Run your bar or restaurant methodically

+
+
+
+
+ +

Hotel + Management

+

An all-inclusive hotel management application

+
+
+
+
+
+
+

+ Support

+
+
+
+
+
+
+
+ +
+ Need + Help? +

Got + questions or need help? Get in touch.

+
odoo@cybrosys.com +
+
+
+
+
+
+
+
+ +
+ WhatsApp +

Say hi to + us on WhatsApp!

+
+91 + 99456767686 +
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/project_task_timer/static/src/css/style.css b/project_task_timer/static/src/css/style.css new file mode 100644 index 000000000..0edd3b158 --- /dev/null +++ b/project_task_timer/static/src/css/style.css @@ -0,0 +1,63 @@ +.switch { + position: relative; + display: inline-block; + width: 30px; + height: 17px; +} + +.switch input { + opacity: 0; + width: 0; + height: 0; +} + +.slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #ccc; + -webkit-transition: .4s; + transition: .4s; +} + +.slider:before { + position: absolute; + content: ""; + height: 13px; + width: 13px; + left: 2px; + bottom: 2px; + background-color: white; + -webkit-transition: .4s; + transition: .4s; +} + +input:checked + .slider { + background-color: green; +} + +input:focus + .slider { + box-shadow: 0 0 1px #2196F3; +} + +input:checked + .slider:before { + -webkit-transform: translateX(13px); + -ms-transform: translateX(13px); + transform: translateX(13px); +} + +/* Rounded sliders */ +.slider.round { + border-radius: 17px; +} + +.slider.round:before { + border-radius: 50%; +} +.timer { + margin-right: 2%; + max-width: 25%; +} \ No newline at end of file diff --git a/project_task_timer/static/src/js/timer.js b/project_task_timer/static/src/js/timer.js new file mode 100644 index 000000000..21f2bd5e0 --- /dev/null +++ b/project_task_timer/static/src/js/timer.js @@ -0,0 +1,105 @@ +/** @odoo-module **/ +// Import statements for necessary modules and utilities +import { registry } from "@web/core/registry"; +import { useService } from "@web/core/utils/hooks"; +import { parseFloatTime } from "@web/views/fields/parsers"; +import { useInputField } from "@web/views/fields/input_field_hook"; +import { standardFieldProps } from "@web/views/fields/standard_field_props"; +import { Component, onWillStart, useState, onWillUpdateProps, onWillDestroy, useRef, onMounted } from "@odoo/owl"; +// Function to format minutes into HH:MM:SS format +function formatMinutes(value) { + if (value === false) { + return ""; + } + const isNegative = value < 0; + if (isNegative) { + value = Math.abs(value); + } + let hours = Math.floor(value / 60); + let minutes = Math.floor(value % 60); + let seconds = Math.floor((value % 1) * 60); + seconds = `${seconds}`.padStart(2, "0"); + minutes = `${minutes}`.padStart(2, "0"); + return `${isNegative ? "-" : ""}${hours}:${minutes}:${seconds}`; +} +export class TaskTimer extends Component { + static template = "TaskTimerTemplate"; + static props = { + ...standardFieldProps + }; + setup() { + this.orm = useService('orm'); + this.toggle = useRef("toggleButton"); + this.timerRunning = false; + this.state = useState({ + duration: this.props.value !== undefined ? this.props.value : this.props.record.data.duration, + }); + // Hook to handle input field related operations + useInputField({ + getValue: () => this.durationFormatted, + refName: "numpadDecimal", + parse: (v) => parseFloatTime(v), + }); + // Functions triggered after the component is mounted + onMounted(() => { + if (this.props.record.data.task_timer) { + this.toggle.el.checked = true; + this._runTimer(); + this.timerRunning = true; + } + }); + // Functions triggered before the component starts + onWillStart(async () => { + // Update duration if ongoing and task timer is active + if (this.props.ongoing === undefined && !this.props.record.model.useSampleModel && this.props.record.data.task_timer) { + const additionalDuration = await this.orm.call('project.task', 'get_working_duration', [this.props.record.resId]); + this.state.duration += additionalDuration; + } + // Start the timer if ongoing and task timer is active + if (this.props.ongoing) { + if (this.props.record.data.task_timer) { + this._runTimer(); + } + } + }); + // Functions triggered before the component is destroyed + onWillDestroy(() => clearTimeout(this.timer)); + } + // Computed property to get the formatted duration + get durationFormatted() { + return formatMinutes(this.state.duration); + } + // Toggle function to start/stop the timer + async toggleFunction() { + if (this.timerRunning) { + // Stop the timer + clearTimeout(this.timer); + this.timerRunning = false; + await this.orm.call('project.task', 'action_toggle_start', [this.props.record.resId, this.timerRunning]); + window.location.reload(); // Reload the window + } else { + // Start the timer + this._runTimer(); + this.timerRunning = true; + await this.orm.call('project.task', 'action_toggle_start', [this.props.record.resId, this.timerRunning]); + } + } + // Function to run the timer + _runTimer() { + this.timer = setTimeout(() => { + // Increment the duration every second + this.state.duration += 1 / 60; + this._runTimer(); // Call recursively to create a continuous timer effect + }, 1000); + } +} +// Definition of taskTimer as a component +export const taskTimer = { + component: TaskTimer, + supportedTypes: ["float"], +}; +// Register the taskTimer component under the "fields" category +registry.category("fields").add("task_timer", taskTimer); + +// Register the formatMinutes function under the "formatters" category +registry.category("formatters").add("task_timer", formatMinutes); diff --git a/project_task_timer/static/src/xml/timer.xml b/project_task_timer/static/src/xml/timer.xml new file mode 100644 index 000000000..97c050dd9 --- /dev/null +++ b/project_task_timer/static/src/xml/timer.xml @@ -0,0 +1,16 @@ + + + + + + + Timer: + + + diff --git a/project_task_timer/views/project_task_views.xml b/project_task_timer/views/project_task_views.xml new file mode 100644 index 000000000..d40d1b325 --- /dev/null +++ b/project_task_timer/views/project_task_views.xml @@ -0,0 +1,34 @@ + + + + + project.task.view.form.inherit.project.task.timer + + project.task + + + + + + + + + + + + + + +