-
Notifications
You must be signed in to change notification settings - Fork 30.1k
[FW][FIX] hr_holidays: fix accrual plan in hours #188719
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
[FW][FIX] hr_holidays: fix accrual plan in hours #188719
Conversation
Steps - create an accrual plan with a level giving 1 hour every month and a carry over with a maximum of 4 hours. Set accrued gain time at the start of the period and carry-over time at start of the year. - create an allocation using this accrual plan, for a time off type in days, set the start date on the first day of next year. - go to Time Off Dashboard - check the balance on the middle of the month of the following year (e.g. 15 january 2026 if the allocation starts on 1 january 2025). -> ~14 days of time off available: the max postpone amount is not applied, the time gained is in days and not in hours and more than 1 day is gained/month (balance a few days after the start of the allocation should be +1 added_value but is more than that). Causes: - the maximum amount of carry over `postpone_max_days` is applied in days even if the accrual `added_value` is in hours and the UI shows `postpone_max_days` as "Up to X hours". - `get_future_leaves` returns a number of hours if the allocation is in hours, even if the time off type is in days. - the number of hours from the accrual at the beginning of the allocation is too high if the start of the accrual is in the future and gain time added at the start of the period due to cache not being invalidated. https://github.com/odoo/odoo/blob/19c7737fc05539079cde8641bab608c605efacc5/addons/hr_holidays/models/hr_leave_allocation.py#L575-L578 opw-4272315 X-original-commit: f9c5502
This PR targets saas-17.4 and is part of the forward-port chain. Further PRs will be created up to master. More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
@taqu-odoo @Bertrand2 child PR #188728 was modified / updated and has become a normal PR. This PR (and any of its parents) will need to be merged independently as approvals won't cross. |
@taqu-odoo @Bertrand2 this forward port of #185699 is awaiting action (not merged or closed). |
3 similar comments
@taqu-odoo @Bertrand2 this forward port of #185699 is awaiting action (not merged or closed). |
@taqu-odoo @Bertrand2 this forward port of #185699 is awaiting action (not merged or closed). |
@taqu-odoo @Bertrand2 this forward port of #185699 is awaiting action (not merged or closed). |
robodoo r+ |
Steps - create an accrual plan with a level giving 1 hour every month and a carry over with a maximum of 4 hours. Set accrued gain time at the start of the period and carry-over time at start of the year. - create an allocation using this accrual plan, for a time off type in days, set the start date on the first day of next year. - go to Time Off Dashboard - check the balance on the middle of the month of the following year (e.g. 15 january 2026 if the allocation starts on 1 january 2025). -> ~14 days of time off available: the max postpone amount is not applied, the time gained is in days and not in hours and more than 1 day is gained/month (balance a few days after the start of the allocation should be +1 added_value but is more than that). Causes: - the maximum amount of carry over `postpone_max_days` is applied in days even if the accrual `added_value` is in hours and the UI shows `postpone_max_days` as "Up to X hours". - `get_future_leaves` returns a number of hours if the allocation is in hours, even if the time off type is in days. - the number of hours from the accrual at the beginning of the allocation is too high if the start of the accrual is in the future and gain time added at the start of the period due to cache not being invalidated. https://github.com/odoo/odoo/blob/19c7737fc05539079cde8641bab608c605efacc5/addons/hr_holidays/models/hr_leave_allocation.py#L575-L578 opw-4272315 closes #188719 X-original-commit: f9c5502 Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
Steps
over with a maximum of 4 hours. Set accrued gain time at the start of the period
and carry-over time at start of the year.
set the start date on the first day of next year.
15 january 2026 if the allocation starts on 1 january 2025).
-> ~14 days of time off available: the max postpone amount is not applied,
the time gained is in days and not in hours and more than 1 day is gained/month
(balance a few days after the start of the allocation should be +1 added_value
but is more than that).
Causes:
postpone_max_days
is applied in dayseven if the accrual
added_value
is in hours and the UI showspostpone_max_days
as "Up to X hours".
get_future_leaves
returns a number of hours if the allocation is in hours, evenif the time off type is in days.
high if the start of the accrual is in the future and gain time added at the start
of the period due to cache not being invalidated.
odoo/addons/hr_holidays/models/hr_leave_allocation.py
Lines 575 to 578 in 19c7737
opw-4272315
Forward-Port-Of: #185699