-
Notifications
You must be signed in to change notification settings - Fork 42
[16.0] [ADD] volunteer_holiday #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Genepi314
wants to merge
27
commits into
16.0
Choose a base branch
from
16.0-add-volunteer_holiday
base: 16.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
a6b1a6d
added volunteer_company_holiday, extended recurrent_generator, draft …
Genepi314 fe0dfa4
cancel holiday shift operational, still lacks company implementation,…
Genepi314 79748ee
commit before switching branch
Genepi314 e7198ae
draft test_cancel_holiday_shift with company + correct README
Genepi314 acc87b7
Add models and views for volunteer leaves, volunteer leave types, and…
Genepi314 a584534
Refacto _cancel_holiday_shift, now using a dictionary and filters by …
Genepi314 130eeb9
Add tracking to is_maintained_during_holiday (bool) in generator.
Genepi314 5218d91
Add freezegun for test_company_holiday
Genepi314 642f6cf
Syntax and decorator fixes in volunteer_company_holidayù
Genepi314 be54c46
Add company for volunteer_leave, record rules for all models, row com…
Genepi314 57a9f43
Add cron and function to cancel volunteer participations during their…
Genepi314 5e83781
small fix _cancel_volunteer_leave_participation().
Genepi314 e260401
Add test for _cancel_volunteer_leave_participation().
Genepi314 8488f36
Add demo data for company holiday, volunteer leave and volunteer leav…
Genepi314 15a6db1
draft new function to uncancel shifts in volunteer_company_holiday (f…
Genepi314 e9688bd
removed copy of method in volunteer_leave, add config for notificatio…
Genepi314 8b1dc76
Add method to send notification for end of volunteer leave, add confi…
Genepi314 6992be1
add badge on shift form view if on holiday, models volunteer_shift an…
Genepi314 432576c
Changed time range to 12 months, for demonstration purpose.
Genepi314 e8b3d46
Add test for computed field overlaps_holiday, add common for all test…
Genepi314 bfdcddf
Add ROADMAP.
Genepi314 396fddf
reformat ROADMAP.
Genepi314 52f09f1
Refactor _cancel_holiday_shift with itertools + remove unnecessary .s…
Genepi314 7896929
Corrections after Remy's comments in PR + cleaned code overall.
Genepi314 ec5a3f7
small fix, override method create() in volunteer.company.holiday, add…
Genepi314 15601c2
Corrections, rewrite _compute_overlap_holiday(), small fixes in volun…
Genepi314 e2e9486
Add fields for _order in volunteer_company_holiday.py
Genepi314 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../volunteer_holiday |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import setuptools | ||
|
|
||
| setuptools.setup( | ||
| setup_requires=['setuptools-odoo'], | ||
| odoo_addon=True, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| ================= | ||
| Volunteer Holiday | ||
| ================= | ||
|
|
||
| .. | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! source digest: sha256:d68150a24904527787d7cde7a5cb68c88f101992b43ec7c25f9a3450eb8d6184 | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
| :target: https://odoo-community.org/page/development-status | ||
| :alt: Beta | ||
| .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
| :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
| :alt: License: AGPL-3 | ||
| .. |badge3| image:: https://img.shields.io/badge/github-beescoop%2FObeesdoo-lightgray.png?logo=github | ||
| :target: https://github.com/beescoop/Obeesdoo/tree/16.0/volunteer_holiday | ||
| :alt: beescoop/Obeesdoo | ||
|
|
||
| |badge1| |badge2| |badge3| | ||
|
|
||
| Add volunteer and company holidays to volunteer app, and manage shifts and generators accordingly. | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Known issues / Roadmap | ||
| ====================== | ||
|
|
||
| - Currently, shifts that were canceled due to company holidays are not marked as such. It can be a source of confusion. | ||
|
|
||
| Add message in the chatter of the shift form view stating that it was canceled because of company holidays. | ||
|
|
||
| - A label indicates whether a shift overlaps with any holiday period ONLY in the shift form view. | ||
|
|
||
| Add the same label in all shift views, especially in the shift list view. | ||
|
|
||
| - No reminder that a shift has been created through a Generator with the bool is_maintained_during_holiday=True is visible on the shift. | ||
|
|
||
| Add a field to the volunteer shift model and views to show this information. | ||
|
|
||
| - Currently, there is no warning or any form of control in the cancellation-of-shifts-due-to-holidays process. | ||
|
|
||
| Add a wizard to control every step of the process when creating company holidays. | ||
| AND/OR Add a button in the company holidays view that would allow to trigger the function that cancels shifts manually. | ||
|
|
||
| - A volunteer's participations are not marked when they overlap with any of their leave. | ||
|
|
||
| Add a computed field similar to overlaps_holiday in volunteer.shift, to display on all views with participations. | ||
|
|
||
| - For now, it is still possible for a volunteer to participate in a shift that over laps withtheir leave. | ||
|
|
||
| Add constraints and an error message if it is attempted. | ||
|
|
||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/beescoop/Obeesdoo/issues>`_. | ||
| In case of trouble, please check there if your issue has already been reported. | ||
| If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
| `feedback <https://github.com/beescoop/Obeesdoo/issues/new?body=module:%20volunteer_holiday%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
|
||
| Do not contact contributors directly about support or help with technical issues. | ||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Authors | ||
| ~~~~~~~ | ||
|
|
||
| * Coop IT Easy SC | ||
|
|
||
| Contributors | ||
| ~~~~~~~~~~~~ | ||
|
|
||
| * `Coop IT Easy SC <https://coopiteasy.be>`_: | ||
|
|
||
| * Geneviève Ernould | ||
|
|
||
| Maintainers | ||
| ~~~~~~~~~~~ | ||
|
|
||
| .. |maintainer-remytms| image:: https://github.com/remytms.png?size=40px | ||
| :target: https://github.com/remytms | ||
| :alt: remytms | ||
|
|
||
| Current maintainer: | ||
|
|
||
| |maintainer-remytms| | ||
|
|
||
| This module is part of the `beescoop/Obeesdoo <https://github.com/beescoop/Obeesdoo/tree/16.0/volunteer_holiday>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # SPDX-FileCopyrightText: 2025 Coop IT Easy SC | ||
| # | ||
| # SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| from . import models | ||
| from . import wizards |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # SPDX-FileCopyrightText: 2026 Coop IT Easy SC | ||
| # | ||
| # SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| { | ||
| "name": "Volunteer Holiday", | ||
| "summary": "Add holidays for companies and volunteers", | ||
| "version": "16.0.0.5.0", | ||
| "category": "Volunteer management", | ||
| "website": "https://github.com/beescoop/Obeesdoo", | ||
| "author": "Coop IT Easy SC", | ||
| "maintainers": ["remytms"], | ||
| "license": "AGPL-3", | ||
| "application": False, | ||
| "depends": ["base", "volunteer", "mail"], | ||
| "data": [ | ||
| "data/cron.xml", | ||
| "security/ir.model.access.csv", | ||
| "security/volunteer_security.xml", | ||
| "views/volunteer_shift_views.xml", | ||
| "views/res_config_settings_views.xml", | ||
| "views/volunteer_shift_generator_views.xml", | ||
| "views/volunteer_company_holiday_view.xml", | ||
| "views/volunteer_volunteer_view.xml", | ||
| "views/volunteer_volunteer_leave_type_view.xml", | ||
| "views/volunteer_volunteer_leave_view.xml", | ||
| "views/volunteer_menu.xml", | ||
| ], | ||
| "demo": [ | ||
| "demo/volunteer_company_holiday_demo.xml", | ||
| "demo/volunteer_volunteer_leave_type_demo.xml", | ||
| "demo/volunteer_volunteer_leave_demo.xml", | ||
| ], | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- | ||
| SPDX-FileCopyrightText: 2025 Coop IT Easy SC | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-or-later | ||
| --> | ||
| <odoo noupdate="1"> | ||
|
|
||
| <record id="ir_cron_cancel_holiday_shift" model="ir.cron"> | ||
| <field | ||
| name="name" | ||
| >Volunteer: Cancel Generated Shifts During Company Holidays</field> | ||
| <field name="model_id" ref="model_volunteer_company_holiday" /> | ||
| <field name="state">code</field> | ||
| <field name="code">model._cancel_holiday_shift()</field> | ||
| <field name="interval_number">24</field> | ||
| <field name="interval_type">hours</field> | ||
| <field name="numbercall">-1</field> | ||
| <field name="doall" eval="False" /> | ||
| </record> | ||
|
|
||
| <record id="ir_cron_cancel_volunteer_leave_participation" model="ir.cron"> | ||
| <field | ||
| name="name" | ||
| >Volunteer: Cancel Participations During Volunteer Leaves</field> | ||
| <field name="model_id" ref="model_volunteer_volunteer_leave" /> | ||
| <field name="state">code</field> | ||
| <field name="code">model._cancel_volunteer_leave_participation()</field> | ||
| <field name="interval_number">24</field> | ||
| <field name="interval_type">hours</field> | ||
| <field name="numbercall">-1</field> | ||
| <field name="doall" eval="False" /> | ||
| </record> | ||
|
|
||
| <record id="ir_cron_send_leave_end_notification" model="ir.cron"> | ||
| <field | ||
| name="name" | ||
| >Notification: Send a Reminder to Volunteers Before their Leave Ends</field> | ||
| <field name="model_id" ref="model_volunteer_volunteer" /> | ||
| <field name="state">code</field> | ||
| <field name="code">model._send_notification_end_leave()</field> | ||
| <field name="interval_number">24</field> | ||
| <field name="interval_type">hours</field> | ||
| <field name="numbercall">-1</field> | ||
| <field name="doall" eval="False" /> | ||
| </record> | ||
|
Comment on lines
+9
to
+46
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we should set the admin user as |
||
|
|
||
| </odoo> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- | ||
| SPDX-FileCopyrightText: 2025 Coop IT Easy SC | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-or-later | ||
| --> | ||
| <odoo> | ||
| <record | ||
| id="volunteer_company_holiday_demo_christmas" | ||
| model="volunteer.company.holiday" | ||
| > | ||
| <field name="name">Christmas Holidays</field> | ||
| <field name="start_date" eval="(datetime.today().replace(month=12, day=24))" /> | ||
| <field name="end_date" eval="(datetime.today().replace(month=12, day=25))" /> | ||
| </record> | ||
|
|
||
| <record | ||
| id="volunteer_company_holiday_demo_store_inventory" | ||
| model="volunteer.company.holiday" | ||
| > | ||
| <field name="name">Store Inventory</field> | ||
| <field name="start_date" eval="(datetime.today().replace(month=7, day=1))" /> | ||
| <field name="end_date" eval="(datetime.today().replace(month=7, day=7))" /> | ||
| </record> | ||
| </odoo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- | ||
| SPDX-FileCopyrightText: 2025 Coop IT Easy SC | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-or-later | ||
| --> | ||
| <odoo> | ||
| <record | ||
| id="volunteer_volunteer_leave_demo_vol_a_leave" | ||
| model="volunteer.volunteer.leave" | ||
| > | ||
| <field name="volunteer_id" ref="volunteer.volunteer_demo_a" /> | ||
| <field name="type_id" ref="volunteer_volunteer_leave_type_demo_vacation" /> | ||
| <field | ||
| name="start_date" | ||
| eval="(datetime.now().date() + timedelta(weeks=4, days=4))" | ||
| /> | ||
| <field | ||
| name="end_date" | ||
| eval="(datetime.now().date() + timedelta(weeks=4, days=14))" | ||
| /> | ||
| </record> | ||
|
|
||
| <record | ||
| id="volunteer_volunteer_leave_demo_vol_c_leave" | ||
| model="volunteer.volunteer.leave" | ||
| > | ||
| <field name="volunteer_id" ref="volunteer.volunteer_demo_c" /> | ||
| <field | ||
| name="type_id" | ||
| ref="volunteer_volunteer_leave_type_demo_parental_leave" | ||
| /> | ||
| <field name="start_date" eval="(datetime.now().date() + timedelta(days=4))" /> | ||
| <field | ||
| name="end_date" | ||
| eval="(datetime.now().date() + timedelta(weeks=9, days=4))" | ||
| /> | ||
| </record> | ||
| </odoo> |
31 changes: 31 additions & 0 deletions
31
volunteer_holiday/demo/volunteer_volunteer_leave_type_demo.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- | ||
| SPDX-FileCopyrightText: 2025 Coop IT Easy SC | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-or-later | ||
| --> | ||
| <odoo> | ||
| <record | ||
| id="volunteer_volunteer_leave_type_demo_sick_leave" | ||
| model="volunteer.volunteer.leave.type" | ||
| > | ||
| <field name="name">Sick Leave</field> | ||
| <field name="description">Leave due to illness</field> | ||
| </record> | ||
|
|
||
| <record | ||
| id="volunteer_volunteer_leave_type_demo_parental_leave" | ||
| model="volunteer.volunteer.leave.type" | ||
| > | ||
| <field name="name">Parental Leave</field> | ||
| <field name="description">Leave due to pregnancy/childcare</field> | ||
| </record> | ||
|
|
||
| <record | ||
| id="volunteer_volunteer_leave_type_demo_vacation" | ||
| model="volunteer.volunteer.leave.type" | ||
| > | ||
| <field name="name">Vacation</field> | ||
| <field name="description">Vacation</field> | ||
| </record> | ||
| </odoo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # SPDX-FileCopyrightText: 2025 Coop IT Easy SC | ||
| # | ||
| # SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| from . import res_company | ||
| from . import volunteer_company_holiday | ||
| from . import volunteer_shift_recurrent_generator | ||
| from . import volunteer_volunteer | ||
| from . import volunteer_volunteer_leave_type | ||
| from . import volunteer_volunteer_leave | ||
| from . import volunteer_shift |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # SPDX-FileCopyrightText: 2025 Coop IT Easy SC | ||
| # | ||
| # SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class ResCompany(models.Model): | ||
| _inherit = ["res.company"] | ||
|
|
||
| nb_days_before_leave_end = fields.Integer( | ||
| string="Number of days for notification before end of leave", | ||
| default=7, | ||
| ) | ||
|
|
||
| _sql_constraints = [ | ||
| ( | ||
| "nb_days_is_pos", | ||
| "CHECK (nb_days_before_leave_end > 0)", | ||
| "The number of days cannot be null or negative.", | ||
| ), | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.