odoo/odoo#265168
Created by fw-bot
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: (runtime 858s)
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- ci/l10n: (runtime 20s)
- ci/documentation: (runtime 1218s)
- ci/design-theme: (runtime 2034s)
- label
- odoo-dev:saas-19.2-saas-18.4-opw-6112614-correct-weekday-milestones-hr-holidays-bona-527721-fw
- head
- 1d86b1470949c712845585d36446828d8173aa84
- merged
- 1 day ago by Bommisetty Narendra (bona)
| odoo/odoo | |
|---|---|
| saas-18.4 | #259054 |
| 19.0 | #265051 |
| saas-19.1 | #265146 |
| saas-19.2 | #265168 |
| saas-19.3 | #265255 |
| master | #265327 |
[FIX] hr_holidays: correct weekday display in accrual plan levels
Steps to reproduce:
1. Install Time Off
2. Go to Accrual Plans and create a new plan with a milestone
3. Set frequency to Weekly and choose a day other than Monday (e.g., Tuesday)
4. Save and check the displayed weekday in the accrual plan level
Issue:
The displayed weekday is incorrect (e.g., shows Monday instead of Tuesday).
Cause:
Previously, the weekday value was directly displayed using: https://github.com/odoo/odoo/blob/b40184ab371f7a4708621ecf7f25b4e2daaae38d/addons/hr_holidays/views/hr_leave_accrual_views.xml#L212-L214 so no conversion was involved.
Now, the value is processed using Luxon. However, the week_day field stores values from 0 (Monday) to 6 (Sunday), while Luxon expects ISO weekday numbers from 1 (Monday) to 7 (Sunday). This mismatch causes an off-by-one error during conversion.
https://github.com/odoo/odoo/blob/1b3d0a3c2f794324f8b230a9ae19f097454e3bdd/addons/hr_holidays/models/hr_leave_accrual_plan_level.py#L54-L62
Solution:
Adjust the value before passing it to Luxon by adding +1 to match ISO format.
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #259054