Skip to content
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

[16.0][ADD] resource_multi_week_calendar #1384

Open
wants to merge 14 commits into
base: 16.0
Choose a base branch
from

Conversation

carmenbianca
Copy link
Member

@carmenbianca carmenbianca commented Aug 2, 2024

Allow a calendar to alternate between multiple weeks.

An implementation of this functionality exists in Odoo's resource module since version 13. In Odoo's implementation, you can only alternate between two weeks.

This implementation is more generic.

At time of writing, it is heavily WIP.

Internal task: T12626

@carmenbianca carmenbianca force-pushed the 16.0-resource_multi_week_calendar branch 3 times, most recently from 9f3f079 to 4768f83 Compare August 30, 2024 11:59
Signed-off-by: Carmen Bianca BAKKER <[email protected]>
…calendar

This is the bones of the implementation.

Signed-off-by: Carmen Bianca BAKKER <[email protected]>
…atch

This is the real implementation work. With this method implemented, all
other methods correctly get the correct week each time.

Signed-off-by: Carmen Bianca BAKKER <[email protected]>
The epoch date is hidden on the child anyway. Let's just hide it, and
always make sure to get the parent's epoch date. This gets rid of the
complicated computation stuff that won't backport well to v12.

Signed-off-by: Carmen Bianca BAKKER <[email protected]>
…s attendances

The idea here is that the children contain all the logic/attendances,
and the parent is just a holder of children.

Signed-off-by: Carmen Bianca BAKKER <[email protected]>
@carmenbianca carmenbianca force-pushed the 16.0-resource_multi_week_calendar branch from ebe510f to 6c19789 Compare August 30, 2024 15:54
@carmenbianca carmenbianca marked this pull request as ready for review September 2, 2024 09:19
@carmenbianca
Copy link
Member Author

tagging @huguesdk , this is ready for review :)

I need this elsewhere. It _technically_ reduces performance by doing the
same calculation twice, but this module is horrible as pertains to
performance in any case.

Signed-off-by: Carmen Bianca BAKKER <[email protected]>
- `parent_calendar_id` is now `ondelete="cascade"`.
- Renamed `family_calendar_ids` to `multi_week_calendar_ids`.
- Renamed `current_calendar_id` to `current_multi_week_calendar_id`.
- Renamed `_get_calendar` to `_get_multi_week_calendar`.

Signed-off-by: Carmen Bianca BAKKER <[email protected]>
Copy link
Member

@huguesdk huguesdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work! 👍

- Improved the comment on how week_sequence works.
- Renamed family_size to calendar_count
- Added a comment on _get_multi_week_calendar() returning a 1-item
  recordset.
- Re-optimised the current week calculation.

Signed-off-by: Carmen Bianca BAKKER <[email protected]>
@carmenbianca carmenbianca force-pushed the 16.0-resource_multi_week_calendar branch from d5ae526 to d0a05ee Compare September 9, 2024 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants