fix(UX): enable Track Changes, show allocation history for earned leaves allocated via scheduler #30613
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.
Background:
If Leave Policy Assignment is created for Earned Leave, initially 0 leaves are allocated and then allocation happens every month based on the configuration set in Leave Type.
eg Policy: Annual Allocation: 24, Frequency: Monthly
In this case, 2 leaves will be allocated every month for the employee via scheduler.
Problem:
Users are directly shown Total Leaves Allocated in Leave Allocation.

There is no trace of when the scheduler allocates these leaves because this happens via
db_set
"New Leaves Allocated" field is editable after submission even for Earned Leave type with policy assignment which doesn't make sense because this allocation happens via scheduler. Users can reset leaves to 0 directly, without any trace and ledgers do not handle this.
There is one more setting that decides when this leave will be allocated via the scheduler in Leave Type master. If Based on Date of Joining is enabled, it allocates leave every month on the Joining Date of the employee, else on month-end.
Basically, users have to see 3 different things and do the mental math to derive the number of leaves shown in the allocation: the annual allocation, the number of months that have passed, and the based on DOJ setting.
Fix:
Based on DOJ:
Usual: