feat(earned_leaves): support earned leave accrual after configurable service or eligibility days - #5013
Open
md-umair-21 wants to merge 4 commits into
Open
feat(earned_leaves): support earned leave accrual after configurable service or eligibility days#5013md-umair-21 wants to merge 4 commits into
md-umair-21 wants to merge 4 commits into
Conversation
…service or eligibility days
Contributor
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (4): Last reviewed commit: "fix(earned_leaves): block eligibility ch..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Some companies require earned leave accrual to begin only after an employee completes a minimum service period.
Although earned leave already supports periodic accrual, there was no server-side mechanism to delay accrual until the required service period was completed.
The existing applicable_after setting only prevents employees from applying for leave. It does not delay earned leave accrual.
This could result in earned leave accruing before the intended service period
Solution:-
This PR introduces earned leave eligibility based on the employee's Date of Joining.
Earned leave accrual begins only after the employee completes the configured number of calendar days of service.
Changes Applied:-
Why:
Introduced logic to calculate the accrual eligibility date using:
date_of_joining + earned_leave_eligibility_days
The effective accrual start date is calculated as:
max(effective_from, date_of_joining + eligibility_days)
Why:
Accrual must not begin before both:
Why:
Why:
Why:
Why:
Added tests for:
Why:
Use Case
A company policy may require earned leave to begin only after an employee completes a defined service period, such as 365 calendar days from the Date of Joining.
In this case:
Example Scenario
Date of Joining: 2025-06-15
Eligibility Days: 365
Leave Period: 2026-01-01 to 2026-12-31
Leave Control Panel Based On: Leave Period
Annual Allocation: 30
Frequency: Monthly
Allocate On Day: First Day
Assignment Created On: 2026-07-28
Expected Result
Feature Flow
Test Scenarios
no-docs