odoo/odoo#234193

Created by fw-bot
Merged at fdc6047aa52f9bfaed50b2a0e39757e389caa65f

Statuses:

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)

task-4430044

Co-authored-by: @mepe-odoo

Forward-Port-Of: #233817
Forward-Port-Of: #193186