fix: total leaves allocated not validated and recalculated on updates post submission #30569
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
In Leave Allocation, if New Leaves Allocated field is updated via Data Import or API, Total Leaves Allocated is not recalculated on the server-side post submission. Moreover, the following validations don't run if someone updates allocation after submission:
validate_back_dated_allocation
: To check if the allocation that is being updated is already carried forward to a future allocationvalidate_total_leaves_allocated
: To check if the total leaves allocated are more than the days in the period, eg: should not allow 30 leaves being allocated for 15 daysvalidate_leave_allocation_days
: To check if the total leaves allocated do not exceedmax_leaves_allowed
within the leave period setup in Leave TypeFix
on_update_after_submit