diff --git a/easy_timesheet_add/README.rst b/easy_timesheet_add/README.rst new file mode 100755 index 000000000..62c02216b --- /dev/null +++ b/easy_timesheet_add/README.rst @@ -0,0 +1,44 @@ +.. 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 + +Quick Add Timesheet +==================== +* Easily Add Timesheet Via Systray. + +Configuration +============ +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (AGPL V3). +(http://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +Developer: (V15) Mruthul Raj, Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@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 https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ diff --git a/easy_timesheet_add/__init__.py b/easy_timesheet_add/__init__.py new file mode 100644 index 000000000..1f2192095 --- /dev/null +++ b/easy_timesheet_add/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Mruthul Raj (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/easy_timesheet_add/__manifest__.py b/easy_timesheet_add/__manifest__.py new file mode 100755 index 000000000..6e252babd --- /dev/null +++ b/easy_timesheet_add/__manifest__.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Mruthul Raj (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': "Quick Add Timesheet", + 'version': '15.0.1.0.0', + 'category': 'Project', + 'summary': 'Easily Add Timesheet Via Systray', + 'description': """The module helps to add timesheet from systray by + selecting project, task and Contents for timesheet.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['hr_timesheet'], + 'assets': { + 'web.assets_backend': [ + 'easy_timesheet_add/static/src/js/TimesheetSystray.js', + ], + 'web.assets_qweb': [ + 'easy_timesheet_add/static/src/xml/TimesheetSystray.xml', + ] + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/easy_timesheet_add/doc/RELEASE_NOTES.md b/easy_timesheet_add/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..d78d73fd6 --- /dev/null +++ b/easy_timesheet_add/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 25.04.2024 +#### Version 15.0.1.0.0 +#### ADD +- Initial commit for Quick Add Timesheet diff --git a/easy_timesheet_add/models/__init__.py b/easy_timesheet_add/models/__init__.py new file mode 100755 index 000000000..064063f31 --- /dev/null +++ b/easy_timesheet_add/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Mruthul Raj (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 account_analytic_line diff --git a/easy_timesheet_add/models/account_analytic_line.py b/easy_timesheet_add/models/account_analytic_line.py new file mode 100755 index 000000000..d57276a05 --- /dev/null +++ b/easy_timesheet_add/models/account_analytic_line.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Mruthul Raj (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): + """Inherits account_analytic_line to store timesheet adding via systray""" + _inherit = 'account.analytic.line' + + start_time = fields.Datetime(string="Start Time", + help="To store start time of timesheet") + end_time = fields.Datetime(string="End Time", + help="To store end time of timesheet") + current_state = fields.Selection([('play', 'play'), ('pause', 'pause')], + string="Current State", + help="To manage the timesheet adding via " + "systray") + pausing_time = fields.Char(help="To store time on pausing", + string="Pause Time") + is_current = fields.Boolean(help="Check is timesheet completed or not", + string="Timesheet Completion") diff --git a/easy_timesheet_add/static/description/assets/icons/cogs.png b/easy_timesheet_add/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/cogs.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/consultation.png b/easy_timesheet_add/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/consultation.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/ecom-black.png b/easy_timesheet_add/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/ecom-black.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/education-black.png b/easy_timesheet_add/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/education-black.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/hotel-black.png b/easy_timesheet_add/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/hotel-black.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/license.png b/easy_timesheet_add/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/license.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/lifebuoy.png b/easy_timesheet_add/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/lifebuoy.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/manufacturing-black.png b/easy_timesheet_add/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/manufacturing-black.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/pos-black.png b/easy_timesheet_add/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/pos-black.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/puzzle.png b/easy_timesheet_add/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/puzzle.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/restaurant-black.png b/easy_timesheet_add/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/restaurant-black.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/service-black.png b/easy_timesheet_add/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/service-black.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/trading-black.png b/easy_timesheet_add/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/trading-black.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/training.png b/easy_timesheet_add/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/training.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/update.png b/easy_timesheet_add/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/update.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/user.png b/easy_timesheet_add/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/user.png differ diff --git a/easy_timesheet_add/static/description/assets/icons/wrench.png b/easy_timesheet_add/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/easy_timesheet_add/static/description/assets/icons/wrench.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/categories.png b/easy_timesheet_add/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/categories.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/check-box.png b/easy_timesheet_add/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/check-box.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/compass.png b/easy_timesheet_add/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/compass.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/corporate.png b/easy_timesheet_add/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/corporate.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/customer-support.png b/easy_timesheet_add/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/customer-support.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/cybrosys-logo.png b/easy_timesheet_add/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/cybrosys-logo.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/features.png b/easy_timesheet_add/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/features.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/logo.png b/easy_timesheet_add/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/logo.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/pictures.png b/easy_timesheet_add/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/pictures.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/pie-chart.png b/easy_timesheet_add/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/pie-chart.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/right-arrow.png b/easy_timesheet_add/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/right-arrow.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/star.png b/easy_timesheet_add/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/star.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/support.png b/easy_timesheet_add/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/support.png differ diff --git a/easy_timesheet_add/static/description/assets/misc/whatsapp.png b/easy_timesheet_add/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/misc/whatsapp.png differ diff --git a/easy_timesheet_add/static/description/assets/modules/1.gif b/easy_timesheet_add/static/description/assets/modules/1.gif new file mode 100644 index 000000000..591c8b18d Binary files /dev/null and b/easy_timesheet_add/static/description/assets/modules/1.gif differ diff --git a/easy_timesheet_add/static/description/assets/modules/2.png b/easy_timesheet_add/static/description/assets/modules/2.png new file mode 100644 index 000000000..6bc155887 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/modules/2.png differ diff --git a/easy_timesheet_add/static/description/assets/modules/3.png b/easy_timesheet_add/static/description/assets/modules/3.png new file mode 100644 index 000000000..3599974eb Binary files /dev/null and b/easy_timesheet_add/static/description/assets/modules/3.png differ diff --git a/easy_timesheet_add/static/description/assets/modules/4.png b/easy_timesheet_add/static/description/assets/modules/4.png new file mode 100644 index 000000000..f5174ab22 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/modules/4.png differ diff --git a/easy_timesheet_add/static/description/assets/modules/5.jpg b/easy_timesheet_add/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..cb354010a Binary files /dev/null and b/easy_timesheet_add/static/description/assets/modules/5.jpg differ diff --git a/easy_timesheet_add/static/description/assets/modules/6.png b/easy_timesheet_add/static/description/assets/modules/6.png new file mode 100644 index 000000000..9eea75430 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/modules/6.png differ diff --git a/easy_timesheet_add/static/description/assets/screenshots/1.png b/easy_timesheet_add/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..5fceb1437 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/screenshots/1.png differ diff --git a/easy_timesheet_add/static/description/assets/screenshots/2.png b/easy_timesheet_add/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..9faf399f4 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/screenshots/2.png differ diff --git a/easy_timesheet_add/static/description/assets/screenshots/3.png b/easy_timesheet_add/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..444eb43f6 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/screenshots/3.png differ diff --git a/easy_timesheet_add/static/description/assets/screenshots/hero.gif b/easy_timesheet_add/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..b49221450 Binary files /dev/null and b/easy_timesheet_add/static/description/assets/screenshots/hero.gif differ diff --git a/easy_timesheet_add/static/description/banner.jpg b/easy_timesheet_add/static/description/banner.jpg new file mode 100644 index 000000000..645e76b33 Binary files /dev/null and b/easy_timesheet_add/static/description/banner.jpg differ diff --git a/easy_timesheet_add/static/description/icon.png b/easy_timesheet_add/static/description/icon.png new file mode 100644 index 000000000..250af81eb Binary files /dev/null and b/easy_timesheet_add/static/description/icon.png differ diff --git a/easy_timesheet_add/static/description/index.html b/easy_timesheet_add/static/description/index.html new file mode 100644 index 000000000..3edc9d505 --- /dev/null +++ b/easy_timesheet_add/static/description/index.html @@ -0,0 +1,594 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Quick Add Timesheet

+

+ Easily Add Timesheet Via Systray

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

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ This module in Odoo 15 will help to easily add timesheet in tasks. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + Add Timesheet from systray +
+
+ + Pause and re-start button also available +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ Clock icon in Systray +

+

+ Just click on the icon and select project and task and click on Start button to start the timer +

+ +
+ +
+

+ Countdown Timer +

+

+ You will see a timer and don't forget to add description +

+ +
+ +
+

+ Timesheet in Tasks +

+

+ After stopping the time will be added in the task +

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

Related 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

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

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/easy_timesheet_add/static/src/js/TimesheetSystray.js b/easy_timesheet_add/static/src/js/TimesheetSystray.js new file mode 100644 index 000000000..08cfa7a51 --- /dev/null +++ b/easy_timesheet_add/static/src/js/TimesheetSystray.js @@ -0,0 +1,202 @@ +/** @odoo-module **/ +import { registry } from "@web/core/registry"; +const { Component, useState } = owl; +const { useRef } = owl.hooks; +import { Dropdown } from "@web/core/dropdown/dropdown"; +import { _t } from "@web/core/l10n/translation"; +import { useService } from "@web/core/utils/hooks"; +/** @extends Component to add methods of timesheet view */ +export class TimesheetSystray extends Component { + async setup() { + this.orm = useService("orm"); + this.notification = useService("notification") + this.timesheet = useRef("Timesheet") + this.state = useState({ + project: [], + task: [], + start: false, + WorkTime: null, + timer: false, + Project: 0, + Task: 0, + time: '', + paused: null, + pausedTime: null, + distance: null, + current_task: [], + Access: null + }) + if ((await this.env.services.user.hasGroup('project.group_project_user') || await this.env.services.user.hasGroup('project.group_project_manager')) && (await this.env.services.user.hasGroup('hr_timesheet.group_hr_timesheet_approver') || await this.env.services.user.hasGroup('hr_timesheet.group_hr_timesheet_user') || await this.env.services.user.hasGroup('hr_timesheet.module_category_services_timesheets'))) { + this.state.Access = true + this.SearchReadTimeSheet() + this.state.project = await this.orm.searchRead('project.project', []) + this.state.Task = await this.orm.searchRead('project.task', []) + } else { + this.state.Access = false + } + } + currentDT() { + const currentDT = new Date(); + const year = currentDT.getFullYear().toString().padStart(4, '0'); + const month = String(currentDT.getMonth() + 1).padStart(2, '0'); //Months are zero-indexed. so,add 1 + const day = currentDT.getDate().toString().padStart(2, '0'); + const hours = currentDT.getHours().toString().padStart(2, '0'); + const minutes = currentDT.getMinutes().toString().padStart(2, '0'); + const seconds = currentDT.getSeconds().toString().padStart(2, '0'); + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; + } + async SearchReadTimeSheet() { + this.employee = await this.orm.searchRead('hr.employee', + [ + ["user_id", "=", this.env.services.user.userId] + ]) + this.state.current_task = await this.orm.searchRead('account.analytic.line', + [ + ["employee_id", "=", this.employee[0].id], + ['is_current', '=', true] + ]) + if (this.state.current_task[0]) { + if (this.state.current_task[0]['end_time']) { + if (this.state.current_task[0]['current_state'] == 'pause') { + var datetime = new Date(new Date().getTime()) + this.state.time = this.state.current_task[0]['pausing_time'] + this.state.paused = true; + this.state.WorkTime = true + } else { + this.state.WorkTime = true + this.state.time = this.state.current_task[0]['pausing_time'] + const newDate = new Date() + const timeParts = this.state.time.split(/[hms\s]+/); + this.state.paused = false; + newDate.setHours(newDate.getHours() - parseInt(timeParts[0])); + newDate.setMinutes(newDate.getMinutes() - parseInt(timeParts[1])); + newDate.setSeconds(newDate.getSeconds() - parseInt(timeParts[2])); + this.StartCountTime(new Date(newDate).getTime()) + } + } else { + this.current_time = new Date(this.state.current_task[0]['start_time']) + this.state.WorkTime = true + this.StartCountTime(this.current_time.getTime()) + } + } else { + return + } + } + /** Start counting the time **/ + async StartTime() { + this.SearchReadTimeSheet() + this.MainDiv = this.timesheet.el + if (!this.MainDiv.querySelector(".Project").value || + !this.MainDiv.querySelector(".Task").value) { + return this.notification.add(_t("Choose Project and Task"), { + type: 'warning' + }) + } + this.state.start = true; + this.state.WorkTime = true; + this.state.time = this.MainDiv.querySelector(".time").innerHTML; + this.state.Project = this.MainDiv.querySelector(".Project").value + this.state.Task = this.MainDiv.querySelector(".Task").value + this.state.timer = new Date().getTime() + await this.orm.create("account.analytic.line", { + project_id: parseInt(this.state.Project), + task_id: parseInt(this.state.Task), + start_time: await this.currentDT(), + name: " ", + is_current: true + }); + this.SearchReadTimeSheet() + } + /** Pause the time and store the time **/ + async PauseTime() { + await this.orm.write("account.analytic.line", [this.state.current_task[0].id], { + end_time: await this.currentDT(), + pausing_time: this.state.time, + current_state: 'pause' + }) + await clearInterval(this.StopWatch); + this.state.paused = true; + window.location.reload(); + } + /** Start after pause and change the state **/ + async PlayTime() { + this.state.pausedTime = this.state.current_task[0].pausing_time + await this.orm.write("account.analytic.line", [this.state.current_task[0].id], { + current_state: 'play' + }) + this.SearchReadTimeSheet() + } + /** Add timesheet based on project, task and time **/ + async AddTimesheet() { + if (!this.timesheet.el.querySelector(".Description").value) { + return this.notification.add(_t("Add a Description"), { type: 'warning'}); + }else { + /** Convert 02h 30m format time => 02:30 and create timesheet**/ + const timeParts = this.state.time.split(/h |m/); + const hours = Number(timeParts[0]); + const minutes = Number(timeParts[1]); + await this.orm.write("account.analytic.line", [this.state.current_task[0].id], { + end_time: await this.currentDT(), + unit_amount: hours + minutes / 60, + name: this.timesheet.el.querySelector(".Description").value, + is_current : false + }) + } + await clearInterval(this.StopWatch); + this.state.time = '' + this.state.WorkTime = false; + window.location.reload() + } + /** Running the count down using setInterval function */ + StartCountTime(start_time) { + var self = this + self.StopWatch = setInterval(function() { + var currentTime = new Date().getTime() + self.state.distance = currentTime - start_time + var days = Math.floor(self.state.distance / (1000 * 60 * 60 * 24)); + var hours = Math.floor((self.state.distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + var minutes = Math.floor((self.state.distance % (1000 * 60 * 60)) / (1000 * 60)); + var seconds = Math.floor((self.state.distance % (1000 * 60)) / 1000); + if (hours && minutes && seconds) { + self.state.time = hours + "h " + minutes + "m " + seconds + 's'; + } else if (minutes && seconds) { + self.state.time = "00h " + minutes + "m " + seconds + 's'; + } else if (seconds) { + self.state.time = '00h 00m ' + seconds + 's'; + } else { + self.state.time = '00h 00m 00s'; + } + self.orm.write("account.analytic.line", [self.state.current_task[0].id], { + pausing_time: self.state.time + }) + }, 1000); + } + /** Filter the tasks bases on selected project **/ + async ChangeProject(project_id) { + if (project_id) { + this.state.Task = await this.orm.searchRead('project.task', + [ + ["project_id", "=", parseInt(project_id)] + ]) + } + } + /** Filter the tasks bases on selected project **/ + async ChangeTask(task_id) { + if (task_id) { + var project = await this.orm.searchRead('project.project', [ + ["task_ids", "in", [parseInt(task_id)]] + ]) + this.timesheet.el.querySelector(".Project").value = project[0].id + } + } +} +TimesheetSystray.template = "TimesheetSystray"; +TimesheetSystray.components = { + Dropdown +}; +export const systrayItem = { + Component: TimesheetSystray, +}; +registry.category("systray").add("TimesheetSystray", systrayItem, { + sequence: 105 +}); diff --git a/easy_timesheet_add/static/src/xml/TimesheetSystray.xml b/easy_timesheet_add/static/src/xml/TimesheetSystray.xml new file mode 100644 index 000000000..0a7ce1280 --- /dev/null +++ b/easy_timesheet_add/static/src/xml/TimesheetSystray.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + +
+
+ +
+
Project
+
+ +
+
+
+
Task
+
+ +
+
+
+ +
+
+ Description +
+
+