Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: expired leave balance is -ve when leaves taken > carry forwarded expired leaves (backport #1288) #1292

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ def get_allocated_and_expired_leaves(
# leave allocations ending before to_date, reduce leaves taken within that period
# since they are already used, they won't expire
expired_leaves += record.leaves
expired_leaves += get_leaves_for_period(employee, leave_type, record.from_date, record.to_date)
leaves_for_period = get_leaves_for_period(
employee, leave_type, record.from_date, record.to_date
)
expired_leaves -= min(abs(leaves_for_period), record.leaves)

if record.from_date >= getdate(from_date):
if record.is_carry_forward:
Expand Down
Loading