-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
refactor: Employee Leave Balance #29439
Merged
ruchamahabal
merged 28 commits into
frappe:develop
from
ruchamahabal:leave-opening-balance
Mar 13, 2022
Merged
refactor: Employee Leave Balance #29439
ruchamahabal
merged 28 commits into
frappe:develop
from
ruchamahabal:leave-opening-balance
Mar 13, 2022
Conversation
This file contains 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
erpnext/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py Lines 121 to 122 in b8fbfed
I don't understand what the comment means here 🙃 |
Codecov Report
@@ Coverage Diff @@
## develop #29439 +/- ##
===========================================
+ Coverage 60.18% 60.57% +0.39%
===========================================
Files 1084 1084
Lines 68547 68609 +62
===========================================
+ Hits 41253 41561 +308
+ Misses 27294 27048 -246
|
ruchamahabal
force-pushed
the
leave-opening-balance
branch
from
January 31, 2022 16:15
77ce0ee
to
da7ff83
Compare
ruchamahabal
changed the title
fix: incorrect opening balance for leave allocation period start date
refactor: Employee Leave Balance Report
Jan 31, 2022
- incorrect opening balance on boundary allocation dates - carry forwarded leaves accounted in leaves allocated column, should be part of opening balance - leaves allocated column also adds expired leave allocations causing negative balances, should only consider non-expiry records
ruchamahabal
force-pushed
the
leave-opening-balance
branch
from
January 31, 2022 16:21
da7ff83
to
538b64b
Compare
…expiry ledger entries
- fix issue where Leaves Taken also adds leaves expiring on boundary date as leaves taken, causing ambiguity - remove unnecessary `skip_expiry_leaves` function - `get_allocation_expiry` considering cancelled entries too
ruchamahabal
force-pushed
the
leave-opening-balance
branch
from
February 3, 2022 18:31
d88f7fd
to
26b40e7
Compare
- Leave Balance shows minimum leaves remaining after comparing with remaining days for allocation expiry causing ambiguity - refactor remaining leaves calculation to return both, actual leave balance and balance for consumption - show actual balance in leave application, use balance for consumption only in validations
ruchamahabal
changed the title
refactor: Employee Leave Balance Report
refactor: Employee Leave Balance Reports
Feb 4, 2022
ruchamahabal
force-pushed
the
leave-opening-balance
branch
from
February 4, 2022 07:10
bd1ad02
to
b5c686a
Compare
…lance - not changing opening balance based on remaining days
- fix expired leaves calculation when filters span across 2 different allocation periods
ruchamahabal
changed the title
refactor: Employee Leave Balance Reports
refactor: Employee Leave Balance
Feb 28, 2022
- total leaves allocated considering cancelled leaves - optional plural for leave category labels - show dashboard only once from date is set, else it fetches all allocations till date and generates incorrect balance - change pending leaves to 'Leaves Pending Approval' for better context - update labels in Salary Slip Leave Details table
ruchamahabal
force-pushed
the
leave-opening-balance
branch
from
February 28, 2022 08:42
167da91
to
942511c
Compare
ruchamahabal
force-pushed
the
leave-opening-balance
branch
from
February 28, 2022 12:00
d0b74ec
to
3f3b176
Compare
- fix: ledger entry for expiring cf leaves not considering holidays
ruchamahabal
requested review from
pateljannat,
nextchamp-saqib and
deepeshgarg007
as code owners
March 9, 2022 13:49
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.
Problems
1. Leave Balance Problems
1.1 Incorrect Opening Balances
Problem
Create Leave Allocation for last year (1-1-2021 to 31-12-2021)
Check Leave Balance Summary for this year:
Opening Balance is incorrect while checking leave balance on leave allocation period's start date. Opening Balance is the leave balance 1 day before the filter start date. i.e. it fetches leave balance on 31st Dec 2021. However, the leaves are not carried forward to the next leave allocation, hence the opening balance should be 0, not 1 since it expires on 1st.
These carry forwarded leaves were instead accounted in leaves allocated column, should be part of the opening balance.
Fix
If the previous allocation's expiry is the same as the opening balance date (filter from date - 1), then fetch the carry forwarded leave balance on that day. If not carry-forwarded then it should be 0.
eg: Here Casual Leave was not carry-forwarded, balance is 0. 10 Sick Leaves were carry forwarded, so opening balance is 10.
If the balance is not being checked on allocation boundary, fetch opening balance as usual.
1.2 Leaves Allocated column also adds expired leave allocations causing negative balances
Problem:
When the allocation period ends, it creates a separate Leave Ledger Entry with (-1 * leaves) to expire and reduce the leave balance. Such leave ledgers were not being ignored while calculation leaves allocated in the leave balance report.
Fix:
Ignore leave ledger entries with
is_expired = 1
as they are not part of leave allocation.1.3 Leaves Taken also adds leaves expiring on boundary date as leaves taken, causing ambiguity
Problem
Fix
1.4 Incorrect Expired Leaves Calculation
More details here:
https://github.com/frappe/erpnext/pull/29439/files#diff-574a6584c831cb44ab451aea33aedce4f2c59e9896221b441c5f24ecb24b4061R200-R211
2. Leave Application Problems
2.1 Leave Summary Table fixes
Before:
After:
2.2 Split Leave Ledger Entries for Leave Application created on boundary
Background:
When User creates a leave application spanning across 2 allocations:
Fix:
Split ledger entries for such applications to have cleaner data.
2.3 Leave Balance in Leave Application
Problem:
Example:
Fix:
This problem is interlinked to 2.2
Show the balance as 14 for the user. Show appropriate validation message: