Skip to content

apply half day configuration at leave application - #289

Merged
sonalimandarnarkar merged 5 commits into
suncycle_version_15_1from
suncycle/suncycle#2156_suncycle_v15
Oct 9, 2026
Merged

sonalimandarnarkar merged 5 commits into
suncycle_version_15_1from
suncycle/suncycle#2156_suncycle_v15

Conversation

@sonalimandarnarkar

@sonalimandarnarkar sonalimandarnarkar commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Parent : https://git.phamos.eu/suncycle/suncycle/-/work_items/2156
Issue : https://git.phamos.eu/suncycle/suncycle/-/work_items/2745

Description :

Leave Application now applies the Half Day Holidays list from HR Addon Settings. HRMS still counts the range, full holidays, and one half day. The addon adds the remaining half-day holidays.

Day count

get_half_day_holiday_dates() reads HR Addon Settings > Half Day Holidays for the leave range. A date already on the employee holiday list is skipped when the leave type does not include holidays.

HrAddonLeaveApplication.validate() sets half_day and half_day_date to the earliest of those dates, then calls HRMS validation. HRMS counts that one date as 0.5 and removes full holidays. reduce_leave_days_for_half_day_holidays() then subtracts 0.5 for every other half-day holiday, and that value is stored in total_leave_days. The leave ledger deducts this saved total.

For 24.12–31.12, with 25.12–27.12 on the holiday list and 24.12 and 31.12 as half-day holidays, the total is 4. Half Day Date stays 24.12.

Form

On refresh and when From Date or To Date changes, leave_application.js calls get_first_half_day_holiday and fills Half Day and Half Day Date. It then calls get_total_leave_days, which runs the HRMS count and the same 0.5 reduction, and sets Total Leave Days. get_half_day_holiday_in_leave is the same lookup, kept so an already open form does not fail.

Tests and CI

hr_addon/tests/test_custom_leave_application.py covers two half-day holidays reducing 5 days to 4, no second reduction for the date already marked half day, no change when the range has none, and the earliest date as Half Day Date. .github/workflows/workday-tests.yml runs that module after the Workday tests, including pull requests into suncycle_version_15_1.

@sonalimandarnarkar
sonalimandarnarkar merged commit a364e54 into suncycle_version_15_1 Oct 9, 2026
1 check passed
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