diff --git a/hr_holiday_generator/README.rst b/hr_holiday_generator/README.rst new file mode 100755 index 000000000..8896f6707 --- /dev/null +++ b/hr_holiday_generator/README.rst @@ -0,0 +1,46 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-green.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +HR Holiday Generator +==================== +* This module allow to generate public holidays of selected country + +Configuration +============= +- Install our custom addon + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +Developer: (V18) Nivedhya T ,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 https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ diff --git a/hr_holiday_generator/__init__.py b/hr_holiday_generator/__init__.py new file mode 100755 index 000000000..58f4e834a --- /dev/null +++ b/hr_holiday_generator/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 +from . import wizard diff --git a/hr_holiday_generator/__manifest__.py b/hr_holiday_generator/__manifest__.py new file mode 100755 index 000000000..3ffe1d709 --- /dev/null +++ b/hr_holiday_generator/__manifest__.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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": "HR Holiday Generator", + "version": "18.0.1.0.0", + "category": 'Human Resources', + "summary": """Generate public holidays based on selected criteria.""", + "description": """This module allows you to generate public holidays based + on selected criteria such as year, month, or a specific date.It provides a + wizard that communicates with an external API to fetch public holiday data + and create corresponding calendar leaves.You can customize the criteria and + view the generated holidays within the wizard itself.""", + "author": "Cybrosys Techno Solutions", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + "depends": ["hr_holidays"], + "data": ["security/ir.model.access.csv", + "views/res_config_settings_views.xml", + "views/holiday_log_views.xml", + "wizard/overlapping_date_views.xml", + "wizard/hr_holiday_generator_views.xml", + "wizard/calendar_leave_generator_views.xml"], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/hr_holiday_generator/doc/RELEASE_NOTES.md b/hr_holiday_generator/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..f95a03565 --- /dev/null +++ b/hr_holiday_generator/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module +#### 10.03.2025 +#### Version 18.0.1.0.0 +##### ADD + +- Initial Commit for HR Holiday Generator diff --git a/hr_holiday_generator/models/__init__.py b/hr_holiday_generator/models/__init__.py new file mode 100755 index 000000000..db8b0d7b8 --- /dev/null +++ b/hr_holiday_generator/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 holiday_log +from . import res_config_settings diff --git a/hr_holiday_generator/models/holiday_log.py b/hr_holiday_generator/models/holiday_log.py new file mode 100755 index 000000000..0c105f6e3 --- /dev/null +++ b/hr_holiday_generator/models/holiday_log.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 HolidayLog(models.Model): + """The model is for showing the holiday logs""" + _name = "holiday.log" + _description = "Holiday Logs" + + name = fields.Char(string="Name", help="name of the public holiday") + start_date = fields.Datetime(string="Start Date", + help="Start date of the public holiday") + end_date = fields.Datetime(string="End Date", + help="End date of the public holiday") + description = fields.Char(string="Description", + help="Description of the public holiday") diff --git a/hr_holiday_generator/models/res_config_settings.py b/hr_holiday_generator/models/res_config_settings.py new file mode 100755 index 000000000..34a3896df --- /dev/null +++ b/hr_holiday_generator/models/res_config_settings.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 ResConfigSettings(models.TransientModel): + """This model is to add an api key and boolean field in the settings""" + _inherit = "res.config.settings" + + holiday_api = fields.Boolean( + string="Holiday Api", + config_parameter='hr_holiday_generator.holiday_api', + help="A boolean to show and hide the api key field.") + holiday_api_key = fields.Char( + string="Api Key", + config_parameter='hr_holiday_generator.holiday_api_key', + help="Please enter the calendarific API key here.") diff --git a/hr_holiday_generator/security/ir.model.access.csv b/hr_holiday_generator/security/ir.model.access.csv new file mode 100755 index 000000000..3a0008de2 --- /dev/null +++ b/hr_holiday_generator/security/ir.model.access.csv @@ -0,0 +1,6 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_hr_holiday_generator_user,access.hr.holiday.generator.user,model_hr_holiday_generator,base.group_user,1,1,1,1 +access_calendar_leave_user,access.calendar.leave.user,model_calendar_leave,base.group_user,1,1,1,1 +access_holiday_log_user,access.holiday.log.user,model_holiday_log,base.group_user,1,1,1,1 +access_overlapping_date_user,access.overlapping.date.user,model_overlapping_date,base.group_user,1,1,1,1 +access_calendar_leave_generator_user,access.calendar.leave.generator.user,model_calendar_leave_generator,base.group_user,1,1,1,1 diff --git a/hr_holiday_generator/static/description/assets/cybro-icon.png b/hr_holiday_generator/static/description/assets/cybro-icon.png new file mode 100644 index 000000000..06e73e11d Binary files /dev/null and b/hr_holiday_generator/static/description/assets/cybro-icon.png differ diff --git a/hr_holiday_generator/static/description/assets/cybro-odoo.png b/hr_holiday_generator/static/description/assets/cybro-odoo.png new file mode 100644 index 000000000..ed02e07a4 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/cybro-odoo.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/arrows-repeat.svg b/hr_holiday_generator/static/description/assets/icons/arrows-repeat.svg new file mode 100644 index 000000000..1d7efabc5 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/arrows-repeat.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/banner-1.png b/hr_holiday_generator/static/description/assets/icons/banner-1.png new file mode 100644 index 000000000..c180db172 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/banner-1.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/banner-2.svg b/hr_holiday_generator/static/description/assets/icons/banner-2.svg new file mode 100644 index 000000000..e606d97d9 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/banner-2.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/banner-bg.png b/hr_holiday_generator/static/description/assets/icons/banner-bg.png new file mode 100644 index 000000000..a8238d3c0 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/banner-bg.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/banner-bg.svg b/hr_holiday_generator/static/description/assets/icons/banner-bg.svg new file mode 100644 index 000000000..b1378103e --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/banner-bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/banner-call.svg b/hr_holiday_generator/static/description/assets/icons/banner-call.svg new file mode 100644 index 000000000..96c687e81 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/banner-call.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/banner-mail.svg b/hr_holiday_generator/static/description/assets/icons/banner-mail.svg new file mode 100644 index 000000000..cbf0d158d --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/banner-mail.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/banner-pattern.svg b/hr_holiday_generator/static/description/assets/icons/banner-pattern.svg new file mode 100644 index 000000000..9c1c7e101 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/banner-pattern.svg @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/banner-promo.svg b/hr_holiday_generator/static/description/assets/icons/banner-promo.svg new file mode 100644 index 000000000..d52791b11 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/banner-promo.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/brand-pair.svg b/hr_holiday_generator/static/description/assets/icons/brand-pair.svg new file mode 100644 index 000000000..d8db7fc1e --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/brand-pair.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/check.png b/hr_holiday_generator/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/check.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/chevron.png b/hr_holiday_generator/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/chevron.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/close-icon.svg b/hr_holiday_generator/static/description/assets/icons/close-icon.svg new file mode 100644 index 000000000..df8cce37a --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/close-icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/cogs.png b/hr_holiday_generator/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/cogs.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/collabarate-icon.svg b/hr_holiday_generator/static/description/assets/icons/collabarate-icon.svg new file mode 100644 index 000000000..dd4e10518 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/collabarate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/hr_holiday_generator/static/description/assets/icons/consultation.png b/hr_holiday_generator/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/consultation.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/cybro-logo.png b/hr_holiday_generator/static/description/assets/icons/cybro-logo.png new file mode 100644 index 000000000..ff4b78220 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/cybro-logo.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/down.svg b/hr_holiday_generator/static/description/assets/icons/down.svg new file mode 100644 index 000000000..f21c36271 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/hr_holiday_generator/static/description/assets/icons/ecom-black.png b/hr_holiday_generator/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/ecom-black.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/education-black.png b/hr_holiday_generator/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/education-black.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/faq.png b/hr_holiday_generator/static/description/assets/icons/faq.png new file mode 100644 index 000000000..4250b5b81 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/faq.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/feature-icon.svg b/hr_holiday_generator/static/description/assets/icons/feature-icon.svg new file mode 100644 index 000000000..fa0ea6850 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/feature-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/feature.png b/hr_holiday_generator/static/description/assets/icons/feature.png new file mode 100644 index 000000000..ac7a785c0 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/feature.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/gear.svg b/hr_holiday_generator/static/description/assets/icons/gear.svg new file mode 100644 index 000000000..0cc66b6ea --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/gear.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/hero.gif b/hr_holiday_generator/static/description/assets/icons/hero.gif new file mode 100644 index 000000000..f26a8f554 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/hero.gif differ diff --git a/hr_holiday_generator/static/description/assets/icons/hire-odoo.svg b/hr_holiday_generator/static/description/assets/icons/hire-odoo.svg new file mode 100644 index 000000000..e1ac089b0 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/hire-odoo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/hotel-black.png b/hr_holiday_generator/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/hotel-black.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/license.png b/hr_holiday_generator/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/license.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/life-ring-icon.svg b/hr_holiday_generator/static/description/assets/icons/life-ring-icon.svg new file mode 100644 index 000000000..3ae6e1d89 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/life-ring-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/lifebuoy.png b/hr_holiday_generator/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/lifebuoy.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/mail.svg b/hr_holiday_generator/static/description/assets/icons/mail.svg new file mode 100644 index 000000000..1eedde695 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/mail.svg @@ -0,0 +1,3 @@ + + + diff --git a/hr_holiday_generator/static/description/assets/icons/manufacturing-black.png b/hr_holiday_generator/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/manufacturing-black.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/notes.png b/hr_holiday_generator/static/description/assets/icons/notes.png new file mode 100644 index 000000000..ee5e95404 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/notes.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/notification icon.svg b/hr_holiday_generator/static/description/assets/icons/notification icon.svg new file mode 100644 index 000000000..053189973 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/notification icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/odoo-consultancy.svg b/hr_holiday_generator/static/description/assets/icons/odoo-consultancy.svg new file mode 100644 index 000000000..e05f65bde --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/odoo-consultancy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/odoo-licencing.svg b/hr_holiday_generator/static/description/assets/icons/odoo-licencing.svg new file mode 100644 index 000000000..2606c88b0 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/odoo-licencing.svg @@ -0,0 +1,3 @@ + + + diff --git a/hr_holiday_generator/static/description/assets/icons/odoo-logo.png b/hr_holiday_generator/static/description/assets/icons/odoo-logo.png new file mode 100644 index 000000000..0e4d0eb5a Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/odoo-logo.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/patter.svg b/hr_holiday_generator/static/description/assets/icons/patter.svg new file mode 100644 index 000000000..25c9c0a8f --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/patter.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/pattern1.png b/hr_holiday_generator/static/description/assets/icons/pattern1.png new file mode 100644 index 000000000..09ab0fb2d Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/pattern1.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/pos-black.png b/hr_holiday_generator/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/pos-black.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/puzzle-piece-icon.svg b/hr_holiday_generator/static/description/assets/icons/puzzle-piece-icon.svg new file mode 100644 index 000000000..3e9ad9373 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/puzzle-piece-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/puzzle.png b/hr_holiday_generator/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/puzzle.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/replace-icon.svg b/hr_holiday_generator/static/description/assets/icons/replace-icon.svg new file mode 100644 index 000000000..d0e3a7af1 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/replace-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/restaurant-black.png b/hr_holiday_generator/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/restaurant-black.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/screenshot-main.png b/hr_holiday_generator/static/description/assets/icons/screenshot-main.png new file mode 100644 index 000000000..575f8e676 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/screenshot-main.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/screenshot.png b/hr_holiday_generator/static/description/assets/icons/screenshot.png new file mode 100644 index 000000000..cef272529 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/screenshot.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/service-black.png b/hr_holiday_generator/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/service-black.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/skype-fill.svg b/hr_holiday_generator/static/description/assets/icons/skype-fill.svg new file mode 100644 index 000000000..c17423639 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/skype-fill.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/skype.png b/hr_holiday_generator/static/description/assets/icons/skype.png new file mode 100644 index 000000000..51b409fb3 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/skype.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/skype.svg b/hr_holiday_generator/static/description/assets/icons/skype.svg new file mode 100644 index 000000000..df3dad39b --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/skype.svg @@ -0,0 +1,3 @@ + + + diff --git a/hr_holiday_generator/static/description/assets/icons/star-1.svg b/hr_holiday_generator/static/description/assets/icons/star-1.svg new file mode 100644 index 000000000..7e55ab162 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/star-1.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/star-2.svg b/hr_holiday_generator/static/description/assets/icons/star-2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/star-2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/support.png b/hr_holiday_generator/static/description/assets/icons/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/support.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/test-1 - Copy.png b/hr_holiday_generator/static/description/assets/icons/test-1 - Copy.png new file mode 100644 index 000000000..f6a902663 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/test-1 - Copy.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/test-1.png b/hr_holiday_generator/static/description/assets/icons/test-1.png new file mode 100644 index 000000000..0908add2b Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/test-1.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/test-2.png b/hr_holiday_generator/static/description/assets/icons/test-2.png new file mode 100644 index 000000000..4671fe91e Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/test-2.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/trading-black.png b/hr_holiday_generator/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/trading-black.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/training.png b/hr_holiday_generator/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/training.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/translate.svg b/hr_holiday_generator/static/description/assets/icons/translate.svg new file mode 100644 index 000000000..af9c8a1aa --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/update.png b/hr_holiday_generator/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/update.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/user.png b/hr_holiday_generator/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/user.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/video.png b/hr_holiday_generator/static/description/assets/icons/video.png new file mode 100644 index 000000000..576705b17 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/video.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/whatsapp.png b/hr_holiday_generator/static/description/assets/icons/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/whatsapp.png differ diff --git a/hr_holiday_generator/static/description/assets/icons/wrench-icon.svg b/hr_holiday_generator/static/description/assets/icons/wrench-icon.svg new file mode 100644 index 000000000..174b5a465 --- /dev/null +++ b/hr_holiday_generator/static/description/assets/icons/wrench-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/hr_holiday_generator/static/description/assets/icons/wrench.png b/hr_holiday_generator/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/hr_holiday_generator/static/description/assets/icons/wrench.png differ diff --git a/hr_holiday_generator/static/description/assets/modules/b1.jpg b/hr_holiday_generator/static/description/assets/modules/b1.jpg new file mode 100644 index 000000000..82f8c6260 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/modules/b1.jpg differ diff --git a/hr_holiday_generator/static/description/assets/modules/b2.jpg b/hr_holiday_generator/static/description/assets/modules/b2.jpg new file mode 100644 index 000000000..5d7ca7c19 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/modules/b2.jpg differ diff --git a/hr_holiday_generator/static/description/assets/modules/b3.jpg b/hr_holiday_generator/static/description/assets/modules/b3.jpg new file mode 100644 index 000000000..05239cada Binary files /dev/null and b/hr_holiday_generator/static/description/assets/modules/b3.jpg differ diff --git a/hr_holiday_generator/static/description/assets/modules/b4.jpg b/hr_holiday_generator/static/description/assets/modules/b4.jpg new file mode 100644 index 000000000..626a61c03 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/modules/b4.jpg differ diff --git a/hr_holiday_generator/static/description/assets/modules/b5.jpg b/hr_holiday_generator/static/description/assets/modules/b5.jpg new file mode 100644 index 000000000..df5014550 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/modules/b5.jpg differ diff --git a/hr_holiday_generator/static/description/assets/modules/b6.jpg b/hr_holiday_generator/static/description/assets/modules/b6.jpg new file mode 100644 index 000000000..672583903 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/modules/b6.jpg differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot1.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot1.png new file mode 100644 index 000000000..42d045f4b Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot1.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot10.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot10.png new file mode 100644 index 000000000..9e76f8642 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot10.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot11.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot11.png new file mode 100644 index 000000000..6bb1b0304 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot11.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot12.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot12.png new file mode 100644 index 000000000..c67a196ae Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot12.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot2.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot2.png new file mode 100644 index 000000000..0872ec703 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot2.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot3.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot3.png new file mode 100644 index 000000000..e7b98526c Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot3.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot4.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot4.png new file mode 100644 index 000000000..97637dda9 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot4.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot5.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot5.png new file mode 100644 index 000000000..790224694 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot5.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot6.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot6.png new file mode 100644 index 000000000..db6086e07 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot6.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot7.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot7.png new file mode 100644 index 000000000..b725b5abc Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot7.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot8.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot8.png new file mode 100644 index 000000000..8ecdf99ea Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot8.png differ diff --git a/hr_holiday_generator/static/description/assets/screenshots/screenshot9.png b/hr_holiday_generator/static/description/assets/screenshots/screenshot9.png new file mode 100644 index 000000000..1fe83cea4 Binary files /dev/null and b/hr_holiday_generator/static/description/assets/screenshots/screenshot9.png differ diff --git a/hr_holiday_generator/static/description/banner.jpg b/hr_holiday_generator/static/description/banner.jpg new file mode 100644 index 000000000..06c880c7a Binary files /dev/null and b/hr_holiday_generator/static/description/banner.jpg differ diff --git a/hr_holiday_generator/static/description/icon.png b/hr_holiday_generator/static/description/icon.png new file mode 100644 index 000000000..5034638fe Binary files /dev/null and b/hr_holiday_generator/static/description/icon.png differ diff --git a/hr_holiday_generator/static/description/index.html b/hr_holiday_generator/static/description/index.html new file mode 100644 index 000000000..42589b507 --- /dev/null +++ b/hr_holiday_generator/static/description/index.html @@ -0,0 +1,1176 @@ + + + + + + HR Holiday Generator + + + + + + + + + + +
+
+ + + +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+
+

+ Generate Public Holidays Based On Selected Criteria. +

+

HR Holiday Generator +

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

Key + Highlights

+
+
+
+
+ +
+
+ Easily select Year, Month, or Date criteria for holiday generation. +
+

+

+
+
+
+
+
+ +
+
+ Automatic Public Holidays Generation. +
+

+

+
+
+
+
+
+ +
+
+ Fetch public holiday data via external API for accuracy. +
+

+ +

+
+
+
+
+ +
+
+
+ HR Holiday Generator +

+ Are you ready to make your business more + organized? +
Improve now! +

+ +
+
+ +
+
+
+ + + +
+
+ +
+
+
+
+ acc_bg +
+ +
+
+
+
+

+ Create an account in + + Calendarific site +

+
+
+

+ Create an account in Calendarific + site. Select the plan. Copy the generated API key. + Account Dashboard --> Home

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

+ Add your + + API key +

+
+
+

+ Add your API key from the Calendarific site in the general + settings for data retrieval. +

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

+ Click on the + + 'Generate' button +

+
+
+

+ Click on the 'Generate' button to Initiate fetching and creation + of Public Holidays based on selected criteria. + Time Off --> Configuration --> Holiday Generator +

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

+ Click on the + + 'Save' button. +

+
+
+

+ Click on the 'Save' button to store generated Public Holidays + records in the system. +

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

+ newly generated + + Public Holidays +

+
+
+

+ The screenshot provides a visual overview of the newly generated Public Holidays. +

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

+ the module identifies + conflicts and + + issues a warning +

+
+
+

+ When overlapping dates are entered, the module identifies + conflicts and issues a warning when the Save button is clicked +

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

+ visual overview of the + + warning +

+
+
+

+ The screenshot provides a visual overview of the warning upon + entering overlapping dates. +

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

+ Records of + + overlapping dates +

+
+
+

+ Records overlapping dates in the Holiday Logs for reference. + Time Off --> Configuration --> Holiday Logs +

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

+ + + +

+
+
+

+ When holidays of same date are entered, the module identifies + conflicts and issues a warning when the Save button is clicked. +

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

+ + + +

+
+
+

+ The screenshot provides a visual overview of the warning upon + entering holidays of same date. Click on CONTINUE button to + continue the process. +

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

+ select one + holiday among the + + same dates +

+
+
+

+ Holidays of same dates can be seen in red colour , select one + holiday among the same dates and click on the SAVE button to + generate Public Holidays in Odoo. +

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

+ + + +

+
+
+

+ After clicking save button generated Public Holidays are shown here. +

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

+ Automatic Public Holidays Generation.

+
+ +
+
+
+
+
+
+ +
+

+ Fetch public holiday data via external API for accuracy.

+
+ +
+
+
+
+
+
+ +
+

+ Easily select Year, Month, or Date criteria for holiday generation.

+
+ +
+
+
+
+
+
+ +
+

+ Detect overlapping dates, alerting users to prevent duplicate holiday records.

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

+ Yes, Odoo allows you to + generate public holidays + automatically based on + predefined country-specific + holiday lists or manually + add custom holidays. +

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

+ Latest Release 18.0.1.0.0 +

+ + 10th March, 2025 + +
+
+
+
+
+ Add +
+
+
+
    +
  • + Initial Commit +
  • +
+
+
+
+
+
+
+
+
+
+ + + +
+

+ Related Products +

+ +
+ +
+

+ Our Services

+ +
+ +
+
+ .... +
+
+ +
+ + +
+
+ + + + + + diff --git a/hr_holiday_generator/views/holiday_log_views.xml b/hr_holiday_generator/views/holiday_log_views.xml new file mode 100755 index 000000000..33d1a87f5 --- /dev/null +++ b/hr_holiday_generator/views/holiday_log_views.xml @@ -0,0 +1,49 @@ + + + + + holiday.log.view.tree + holiday.log + + + + + + + + + + + + holiday.log.view.form + holiday.log + +
+ + + + + + + + + + + + +
+
+
+ + + Holiday Logs + holiday.log + list,form + + + +
diff --git a/hr_holiday_generator/views/res_config_settings_views.xml b/hr_holiday_generator/views/res_config_settings_views.xml new file mode 100755 index 000000000..52b8fbddc --- /dev/null +++ b/hr_holiday_generator/views/res_config_settings_views.xml @@ -0,0 +1,47 @@ + + + + + + res.config.settings.view.form.inherit.hr.holiday.generator + + res.config.settings + + + +
+

Time off

+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
diff --git a/hr_holiday_generator/wizard/__init__.py b/hr_holiday_generator/wizard/__init__.py new file mode 100755 index 000000000..5f9503846 --- /dev/null +++ b/hr_holiday_generator/wizard/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 calendar_leave +from . import calendar_leave_generator +from . import hr_holiday_generator +from . import overlapping_date diff --git a/hr_holiday_generator/wizard/calendar_leave.py b/hr_holiday_generator/wizard/calendar_leave.py new file mode 100755 index 000000000..da299c9a0 --- /dev/null +++ b/hr_holiday_generator/wizard/calendar_leave.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 api, fields, models + + +class CalendarLeave(models.TransientModel): + """Transient model for showing the values in hr holiday generator wizard""" + _name = 'calendar.leave' + _description = 'Calendar Leave' + + holiday_generator_id = fields.Many2one('hr.holiday.generator', + string='Holiday Generator', + help="A Many2one field to connect to" + "the model hr_holiday_generator" + ) + name = fields.Char(string="Name", help="name of the public holiday") + start_date = fields.Datetime(string="Start Date", + help="Start date of the public holiday") + end_date = fields.Datetime(string="End Date", + help="End date of the public holiday") + description = fields.Char(string="Description", + help="Description of the public holiday") + warning = fields.Boolean(string="Warning", + help="Warning to show holidays of same dates", + compute="compute_warning", default=False) + calendar_leave_generator_id = fields.Many2one( + "calendar.leave.generator", + string="Calendar leave generator", + help="For connecting with calendar leave generator") + + @api.depends('start_date') + def compute_warning(self): + """Compute function for the boolean warning""" + for record in self: + same_date_records = self.filtered( + lambda dates: dates.start_date == record.start_date and + dates.id != record.id) + for dates in same_date_records: + dates.warning = True + record.warning = bool(same_date_records) diff --git a/hr_holiday_generator/wizard/calendar_leave_generator.py b/hr_holiday_generator/wizard/calendar_leave_generator.py new file mode 100644 index 000000000..c16d464fa --- /dev/null +++ b/hr_holiday_generator/wizard/calendar_leave_generator.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 CalendarLeaveGenerator(models.TransientModel): + """Transient model for showing repeated calendar leaves""" + _name = 'calendar.leave.generator' + _description = 'Calendar Leave Generator' + + calendar_leave_ids = fields.One2many('calendar.leave', + 'calendar_leave_generator_id', + string='Calender Leave', + help="A One2many field to connect to" + "the model calender leave") + + def action_generate(self): + """Function for generating public holidays or showing the warning""" + existing_holiday = self.env['resource.calendar.leaves'].search([ + ('resource_id', '=', False)]) + overlapping_dates = [] + overlapping_logs = [] + new_holiday_dates = [] + same_date_holidays = set() + for existing in existing_holiday: + for new_holiday in self.calendar_leave_ids: + if existing.date_from.date() == \ + new_holiday.start_date.date() or \ + existing.date_to.date() == new_holiday.end_date.date(): + overlapping_dates.append(new_holiday.start_date.date()) + overlapping_logs.append({ + 'name': new_holiday.name, + 'start_date': new_holiday.start_date, + 'end_date': new_holiday.end_date, + 'description': new_holiday.description + }) + break + for new_holiday in self.calendar_leave_ids: + new_date = new_holiday.start_date.date() + if new_date in new_holiday_dates: + same_date_holidays.add(new_date) + else: + new_holiday_dates.append(new_date) + for log in overlapping_logs: + existing_logs = self.env['holiday.log'].search([ + ('name', '=', log['name']), + ('start_date', '>=', log['start_date']), + ('end_date', '<=', log['end_date'])]) + if not existing_logs: + self.env['holiday.log'].create(log) + if overlapping_dates or same_date_holidays: + warning_message = "" + if overlapping_dates: + existing_dates = ", ".join( + date.strftime('%Y-%m-%d') for date in overlapping_dates) + warning_message += ( + f"Public holidays already exist for the following date(s): " + f"{existing_dates}.\nPlease refer to the logs for detailed " + f"information about the public holidays on these dates.\n\n" + ) + if same_date_holidays: + warning_message += "Select only one holiday per date:\n" + warning_message += \ + "The following dates have multiple holidays:\n" + for date in same_date_holidays: + warning_message += f"\n- {date.strftime('%Y-%m-%d')}" + warning = self.env['overlapping.date'].create( + {'warning': warning_message}) + return { + 'name': 'Overlapping Dates Warning', + 'type': 'ir.actions.act_window', + 'res_model': 'overlapping.date', + 'res_id': warning.id, + 'view_mode': 'form', + 'view_id': self.env.ref( + 'hr_holiday_generator.overlapping_date_view_form').id, + 'target': 'new', + 'context': { + 'active_calendar_leave_ids': self.calendar_leave_ids.ids + } + } + else: + self.env['resource.calendar.leaves'].create([{ + 'name': holiday.name, + 'date_from': holiday.start_date, + 'date_to': holiday.end_date + } for holiday in self.calendar_leave_ids]) \ No newline at end of file diff --git a/hr_holiday_generator/wizard/calendar_leave_generator_views.xml b/hr_holiday_generator/wizard/calendar_leave_generator_views.xml new file mode 100644 index 000000000..ecfb65486 --- /dev/null +++ b/hr_holiday_generator/wizard/calendar_leave_generator_views.xml @@ -0,0 +1,31 @@ + + + + + calendar.leave.generator.view.form + calendar.leave.generator + +
+ + + + + + + + + + + +
+
+
+
+
+
+
diff --git a/hr_holiday_generator/wizard/hr_holiday_generator.py b/hr_holiday_generator/wizard/hr_holiday_generator.py new file mode 100755 index 000000000..95461551b --- /dev/null +++ b/hr_holiday_generator/wizard/hr_holiday_generator.py @@ -0,0 +1,197 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 . +# +################################################################################ +import dateutil +import requests +from odoo import fields, models +from odoo.exceptions import UserError + + +class HrHolidayGenerator(models.TransientModel): + """This model is for creating a wizard and thus generating public holidays + based on selected country.""" + _name = 'hr.holiday.generator' + _description = 'Hr Holiday Generator' + + country_id = fields.Many2one("res.country", string="Country", + help="Select your country from here", + required=True) + generation_mode = fields.Selection( + [('year', 'YEAR'), ('month', 'MONTH'), ('date', 'DATE')], + string="Date/Month/Year", + help="Select date or month or year in which you want to get the public " + "holidays", required=True) + date = fields.Date(string="Date", + default=lambda self: fields.Date.today(), + help="Select the date you want to generate the public " + "holiday") + month = fields.Selection([('1', 'January'), + ('2', 'February'), + ('3', 'March'), + ('4', 'April'), + ('5', 'May'), + ('6', 'June'), + ('7', 'July'), + ('8', 'August'), + ('9', 'September'), + ('10', 'October'), + ('11', 'November'), + ('12', 'December')], string="Month", + help="Select the month you want to generate the " + "public holiday", + default=str(fields.Date.today().month)) + year = fields.Selection( + selection='_get_years_selection', + string="Year", + help="Select the year you want to generate the public holiday", + default=str(fields.Date.today().year)) + calender_leaves_ids = fields.One2many('calendar.leave', + 'holiday_generator_id', + string="Calender leaves", + help="The One2many field to take the " + "values of the model " + "calender_leave") + + def _get_years_selection(self): + """This function is for getting years to select in the field year""" + year_list = [(str(record), str(record)) for record in + range(fields.datetime.now().year - 10, + fields.datetime.now().year + 10)] + return year_list + + def action_generate(self): + """This function is to set the action of button 'Generate'.""" + self.calender_leaves_ids = False + api_key = self.env['ir.config_parameter'].sudo().get_param( + 'hr_holiday_generator.holiday_api_key') or False + if api_key: + base_url = "https://calendarific.com/api/v2/holidays" + url = (f"{base_url}?&api_key={api_key}&country=" + f"{self.country_id.code}") + if self.generation_mode == 'year': + url += f"&year={self.year}" + elif self.generation_mode == 'month': + url += f"&year={self.year}&month={self.month}" + elif self.generation_mode == 'date': + url += (f"&year={self.date.year}&month={self.date.month}" + f"&day={self.date.day}") + response = requests.get(url) + if response.status_code == 200: + holidays_data = response.json() + calendar_leaves = [] + for holiday in holidays_data['response']['holidays']: + iso_datetime = holiday['date']['iso'] + holiday_date = dateutil.parser.parse(iso_datetime).date() + start_datetime = fields.datetime.combine(holiday_date, + fields.time.min) + end_datetime = fields.datetime.combine(holiday_date, + fields.time.max) + calendar_leaves.append(fields.Command.create({ + 'holiday_generator_id': self.id, + 'name': holiday['name'], + 'start_date': start_datetime, + 'end_date': end_datetime, + 'description': holiday['description'] + })) + self.calender_leaves_ids = calendar_leaves + return { + 'type': 'ir.actions.act_window', + 'res_model': 'hr.holiday.generator', + 'res_id': self.id, + 'view_mode': 'form', + 'view_id': self.env.ref( + 'hr_holiday_generator.hr_holiday_generator_view_form').id, + 'target': 'new', + } + else: + raise UserError( + "To retrieve the data, kindly provide the API key in the " + "general settings.") + + def action_save(self): + """This function is to set the action of the button 'save'. """ + existing_holiday = self.env['resource.calendar.leaves'].search([ + ('resource_id', '=', False)]) + overlapping_dates = [] + overlapping_logs = [] + new_holiday_dates = [] + same_date_holidays = set() + for existing in existing_holiday: + for new_holiday in self.calender_leaves_ids: + if existing.date_from.date() == \ + new_holiday.start_date.date() or \ + existing.date_to.date() == new_holiday.end_date.date(): + overlapping_dates.append(new_holiday.start_date.date()) + overlapping_logs.append({ + 'name': new_holiday.name, + 'start_date': new_holiday.start_date, + 'end_date': new_holiday.end_date, + 'description': new_holiday.description + }) + break + for new_holiday in self.calender_leaves_ids: + new_date = new_holiday.start_date.date() + if new_date in new_holiday_dates: + same_date_holidays.add(new_date) + else: + new_holiday_dates.append(new_date) + for log in overlapping_logs: + existing_logs = self.env['holiday.log'].search([ + ('name', '=', log['name']), + ('start_date', '>=', log['start_date']), + ('end_date', '<=', log['end_date']) + ]) + if not existing_logs: + self.env['holiday.log'].create(log) + if overlapping_dates or same_date_holidays: + warning_message = "" + if overlapping_dates: + existing_dates = ", ".join( + date.strftime('%Y-%m-%d') for date in overlapping_dates) + warning_message += ( + f"Public holidays already exist for the following date(s): " + f"{existing_dates}.\nPlease refer to the logs for detailed " + f"information about the public holidays on these dates.\n\n" + ) + if same_date_holidays: + warning_message += "Select only one holiday per date:\n" + warning_message += \ + "The following dates have multiple holidays:\n" + for date in same_date_holidays: + warning_message += f"\n- {date.strftime('%Y-%m-%d')}" + warning = self.env['overlapping.date'].create( + {'warning': warning_message}) + return { + 'name': 'Overlapping Dates Warning', + 'type': 'ir.actions.act_window', + 'res_model': 'overlapping.date', + 'res_id': warning.id, + 'view_mode': 'form', + 'view_id': self.env.ref( + 'hr_holiday_generator.overlapping_date_view_form').id, + 'target': 'new', + } + else: + self.env['resource.calendar.leaves'].create([{ + 'name': holiday.name, + 'date_from': holiday.start_date, + 'date_to': holiday.end_date + } for holiday in self.calender_leaves_ids]) diff --git a/hr_holiday_generator/wizard/hr_holiday_generator_views.xml b/hr_holiday_generator/wizard/hr_holiday_generator_views.xml new file mode 100755 index 000000000..391939a22 --- /dev/null +++ b/hr_holiday_generator/wizard/hr_holiday_generator_views.xml @@ -0,0 +1,65 @@ + + + + + hr.holiday.generator.view.form + hr.holiday.generator + +
+ + + + + + + +