diff --git a/project_task_timer/README.rst b/project_task_timer/README.rst new file mode 100644 index 000000000..908a56483 --- /dev/null +++ b/project_task_timer/README.rst @@ -0,0 +1,22 @@ +Project Task Timer v15 +====================== +Task Timer with Start & Stop + +Installation +============ + - www.odoo.com/documentation/15.0/setup/install.html + - Install our custom addon + +Configuration +============= + + No additional configurations needed + +Credits +======= + Developer: Jesni Banu v10 @ cybrosys, Contact: odoo@cybrosys.com + Kavya Raveendran v11 @ cybrosys, Contact: odoo@cybrosys.com + Kavya Raveendran v12 @ cybrosys, Contact: odoo@cybrosys.com + Sreejith sasidharan v13 @ cybrosys, Contact: odoo@cybrosys.com + Minhaj T v14 @ cybrosys, Contact: odoo@cybrosys.com + Minhaj T v15 @ cybrosys, Contact: odoo@cybrosys.com diff --git a/project_task_timer/__init__.py b/project_task_timer/__init__.py new file mode 100644 index 000000000..1eefcb23a --- /dev/null +++ b/project_task_timer/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# 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 LESSER GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# 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..7fa83e14a --- /dev/null +++ b/project_task_timer/__manifest__.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2021-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# 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 LESSER GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': 'Project Task Timer', + 'version': '15.0.1.0.0', + 'summary': """Task Timer With Start & Stop""", + 'description': """"This module helps you to track time sheet in project automatically.""", + 'category': 'Project', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': "http://www.cybrosys.com", + 'depends': ['base', 'project', 'hr_timesheet'], + 'data': [ + 'views/project_task_timer_view.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'project_task_timer/static/src/js/timer.js', + ]}, + 'images': ['static/description/banner.png'], + '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..2bbb88810 --- /dev/null +++ b/project_task_timer/doc/RELEASE_NOTES.md @@ -0,0 +1,4 @@ +## Module + +#### 07.10.2021 +#### Version 15.0.1.0.0 diff --git a/project_task_timer/models/__init__.py b/project_task_timer/models/__init__.py new file mode 100644 index 000000000..3d840b3d5 --- /dev/null +++ b/project_task_timer/models/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# 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 LESSER GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from . import project_task_timer diff --git a/project_task_timer/models/project_task_timer.py b/project_task_timer/models/project_task_timer.py new file mode 100644 index 000000000..4b3188576 --- /dev/null +++ b/project_task_timer/models/project_task_timer.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# 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 LESSER GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from datetime import datetime +from odoo import models, fields, api + + +class ProjectTaskTimeSheet(models.Model): + _inherit = 'account.analytic.line' + + date_start = fields.Datetime(string='Start Date') + date_end = fields.Datetime(string='End Date', readonly=1) + timer_duration = fields.Float(invisible=1, string='Time Duration (Minutes)') + + +class ProjectTaskTimer(models.Model): + _inherit = 'project.task' + + task_timer = fields.Boolean(string='Timer', default=False) + is_user_working = fields.Boolean( + 'Is Current User Working', compute='_compute_is_user_working', + help="Technical field indicating whether the current user is working. ") + duration = fields.Float( + 'Real Duration', compute='_compute_duration', store=True) + + def _compute_duration(self): + self + + def _compute_is_user_working(self): + """ Checks whether the current user is working """ + 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 + + @api.model + @api.constrains('task_timer') + def toggle_start(self): + if self.task_timer is True: + self.write({'is_user_working': True}) + 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, + 'date_start': datetime.now(), + }) + else: + self.write({'is_user_working': False}) + time_line_obj = self.env['account.analytic.line'] + domain = [('task_id', 'in', self.ids), ('date_end', '=', False)] + for time_line in time_line_obj.search(domain): + 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).replace(microsecond=0) + 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 + + + + 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/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/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/banner.png b/project_task_timer/static/description/banner.png new file mode 100644 index 000000000..8eb268300 Binary files /dev/null and b/project_task_timer/static/description/banner.png 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..a3e8e782b Binary files /dev/null and b/project_task_timer/static/description/icon.png differ diff --git a/project_task_timer/static/description/images/checked.png b/project_task_timer/static/description/images/checked.png new file mode 100644 index 000000000..e6c63d582 Binary files /dev/null and b/project_task_timer/static/description/images/checked.png differ diff --git a/project_task_timer/static/description/images/hero.png b/project_task_timer/static/description/images/hero.png new file mode 100644 index 000000000..388eab059 Binary files /dev/null and b/project_task_timer/static/description/images/hero.png differ diff --git a/project_task_timer/static/description/images/logo.png b/project_task_timer/static/description/images/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/project_task_timer/static/description/images/logo.png differ diff --git a/project_task_timer/static/description/images/modules/barcode_image.png b/project_task_timer/static/description/images/modules/barcode_image.png new file mode 100644 index 000000000..156043839 Binary files /dev/null and b/project_task_timer/static/description/images/modules/barcode_image.png differ diff --git a/project_task_timer/static/description/images/modules/discount_image.png b/project_task_timer/static/description/images/modules/discount_image.png new file mode 100644 index 000000000..5286795e0 Binary files /dev/null and b/project_task_timer/static/description/images/modules/discount_image.png differ diff --git a/project_task_timer/static/description/images/modules/mulitple-ref_image.png b/project_task_timer/static/description/images/modules/mulitple-ref_image.png new file mode 100644 index 000000000..e0964f1e3 Binary files /dev/null and b/project_task_timer/static/description/images/modules/mulitple-ref_image.png differ diff --git a/project_task_timer/static/description/images/modules/partner_image.png b/project_task_timer/static/description/images/modules/partner_image.png new file mode 100644 index 000000000..4003bac15 Binary files /dev/null and b/project_task_timer/static/description/images/modules/partner_image.png differ diff --git a/project_task_timer/static/description/images/modules/pos_order_image.png b/project_task_timer/static/description/images/modules/pos_order_image.png new file mode 100644 index 000000000..1217263a6 Binary files /dev/null and b/project_task_timer/static/description/images/modules/pos_order_image.png differ diff --git a/project_task_timer/static/description/images/modules/sticky_image.png b/project_task_timer/static/description/images/modules/sticky_image.png new file mode 100644 index 000000000..510d36ae9 Binary files /dev/null and b/project_task_timer/static/description/images/modules/sticky_image.png differ diff --git a/project_task_timer/static/description/images/task_timerV13_1.png b/project_task_timer/static/description/images/task_timerV13_1.png new file mode 100644 index 000000000..50cacc8b8 Binary files /dev/null and b/project_task_timer/static/description/images/task_timerV13_1.png differ diff --git a/project_task_timer/static/description/images/task_timerV13_2.png b/project_task_timer/static/description/images/task_timerV13_2.png new file mode 100644 index 000000000..c123ec5c3 Binary files /dev/null and b/project_task_timer/static/description/images/task_timerV13_2.png differ diff --git a/project_task_timer/static/description/images/task_timerV13_3.png b/project_task_timer/static/description/images/task_timerV13_3.png new file mode 100644 index 000000000..309b7af03 Binary files /dev/null and b/project_task_timer/static/description/images/task_timerV13_3.png differ diff --git a/project_task_timer/static/description/images/task_timer_youtube.png b/project_task_timer/static/description/images/task_timer_youtube.png new file mode 100644 index 000000000..fb6579727 Binary files /dev/null and b/project_task_timer/static/description/images/task_timer_youtube.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..ed8619813 --- /dev/null +++ b/project_task_timer/static/description/index.html @@ -0,0 +1,582 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+ +
+
+
+
+ +
+
+ +
+
+

Project Task Timer

+

+ Task Timer with Start & Stop +

+ +
+
+ + + +
+
+

Overview

+
+

+ You have a toggle button to start & stop your task and record your actual working hours. When + you start your task timer, you get a notification, alongside a time sheet entry with starting + time that is automatically generated by the timer for that particular task. When you toggle it + to stop, the tasks' end date shall be updated and the duration gets automatically + calculated. +

+
+
+ + + + +
+
+

Key Features

+
+
+ + +
+ +
+ +

+ Timer in Task. +

+
+ +
+ +

+ Notification when starting the Timer. +

+
+ +
+ +

+ Automatic Timesheet Calculation. +

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

Screenshots

+
+ + +
+
+

+ 01

+
+
+

+ Projects -> Task +

+

+ After installation, open Projects and go to any task. +

+ +
+
+ + + + +
+
+

+ 02

+
+
+

+ Enable the timer +

+

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

+ +
+
+ + + + +
+
+

+ 03

+
+
+

+ Disabling the timer +

+

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

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

Video

+
+
+ Cybrosys Cover Video +
+
+
+ + + + + +
+
+

Suggested Products

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

Our Services

+
+
+ +
+
+ +
+
Odoo + Customization
+
+ +
+
+ +
+
Odoo + Implementation
+
+ +
+
+ +
+
Odoo + Support
+
+ + +
+
+ +
+
Hire + Odoo + Developer
+
+ +
+
+ +
+
Odoo + Integration
+
+ +
+
+ +
+
Odoo + Migration
+
+ + +
+
+ +
+
Odoo + Consultancy
+
+ +
+
+ +
+
Odoo + Implementation
+
+ +
+
+ +
+
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

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

Need Help?

+
+
+
+ + +
+ +
+ +
+ +
+ WhatsApp +
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + + +
+
\ 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..263ca45de --- /dev/null +++ b/project_task_timer/static/src/js/timer.js @@ -0,0 +1,70 @@ +odoo.define('project_task_timer.timer', function (require) { +"use strict"; +var AbstractField = require('web.AbstractField'); +var core = require('web.core'); +var field_registry = require('web.field_registry'); +var time = require('web.time'); +var FieldManagerMixin = require('web.FieldManagerMixin'); + +var _t = core._t; + +// $(document).on('click','#timer', function(){ +// if ($(this).hasClass('btn-secondary')) +// { $(this).removeClass('btn-secondary'); +// $(this).addClass('btn-primary'); +// } +// }); + +var TimeCounter = AbstractField.extend({ + + willStart: function () { + var self = this; + var def = this._rpc({ + model: 'account.analytic.line', + method: 'search_read', + domain: [['task_id', '=', this.res_id], ['user_id', '=', self.record.context['uid']]], + }).then(function (result) { + if (self.mode === 'readonly') { + var currentDate = new Date(); + self.duration = 0; + _.each(result, function (data) { + self.duration += data.date_end ? + self._getDateDifference(data.date_start, data.date_end): + self._getDateDifference(time.auto_str_to_date(data.date_start), currentDate); + }); + } + }); + return $.when(this._super.apply(this, arguments), def); + }, + destroy: function () { + this._super.apply(this, arguments); + clearTimeout(this.timer); + }, + isSet: function () { + return true; + }, + _getDateDifference: function (dateStart, dateEnd) { + return moment(dateEnd).diff(moment(dateStart)); + }, + + _render: function () { + this._startTimeCounter(); + }, + _startTimeCounter: function () { + var self = this; + clearTimeout(this.timer); + if (this.record.data.is_user_working) { + this.timer = setTimeout(function () { + self.duration += 1000; + self._startTimeCounter(); + }, 1000); + } else { + clearTimeout(this.timer); + } + this.$el.html($('' + moment.utc(this.duration).format("HH:mm:ss") + '')); + }, +}); +field_registry.add('timesheet_uoms', TimeCounter); +}); + + diff --git a/project_task_timer/views/project_task_timer_view.xml b/project_task_timer/views/project_task_timer_view.xml new file mode 100644 index 000000000..c01021c8e --- /dev/null +++ b/project_task_timer/views/project_task_timer_view.xml @@ -0,0 +1,46 @@ + + + + + project task timer + project.task + + + + + +
+ +
+
+
+
+ + + project task timer1 + project.task + + + + + + + + + + + + +
+
\ No newline at end of file