odoo/odoo#234193
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/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 25s)
- label
- odoo-dev:master-18.0-l10n-in-hr-holidays-sandwich-leave-yava-474044-fw
- head
- e4dd001078de6433038c61a420369862a4587487
- merged
- 2 weeks ago by Fun HR, Yash Vaishnav (yava)
| odoo/odoo | |
|---|---|
| 18.0 | #193186 |
| saas-18.2 | #233613 |
| saas-18.3 | #233717 |
| saas-18.4 | #233781 |
| 19.0 | #233817 |
| master | #234193 |
[FIX] l10n_in_hr_holidays: fixed duration of the sandwich leave
Before this PR, if you created a leave of a type that had sandwich leave
enabled on a non-working day, it would show a negative duration.
This PR fixes some issues related to sandwich leave cases
(where Saturday and Sunday are considered non-working days):
- Friday - Monday across weekend - counted (4 days).
- Hour-based leave types: weekend bridging increases hours accordingly
- Public holiday in the middle (Tue-Thu with Wed PH) - counted (3 days).
- Stop/Start exactly on a public holiday(Tue-Wed(Public holiday), or Wed(Public holiday)-Thu) - trimmed to 1 day.
- Public holiday only - 0 days.
- Two single-day leaves around a Public holiday
- When the second leave is created, it bridges via a public holiday (2 days),
- The first one remains 1 day if it stands alone
- Mixed leave types:
- If the linked leave type doesn’t have sandwich enabled, no sandwich rules.
- If both leave enable sandwich (with different types) - sandwich rule applies
- Refusing/canceling a linked leave must immediately adjust the other side’s duration
(e.g., Monday refused - Friday drops from 3 - 1 day)
Co-authored-by: @mepe-odoo