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: leave balance for earned leaves in backdated Leave Application dashboard #31253

Merged
merged 2 commits into from
Jun 7, 2022

Conversation

ruchamahabal
Copy link
Member

Problem

  1. Create Leave Policy Assignment for earned leaves with 8 leaves allocated at first.

    allocation
  2. Earned Leaves are allocated in April and May end.

  3. Try creating a backdated leave application for April. It shows balance as 12 and 4 leaves expired. Although 12 leaves weren't available on April 1st, only 8 were available and there were no expired leaves

image

This problem only occurs in the case of Earned Leaves because they are added based on policy frequency, unlike other leaves which are allocated all at once on allocation creation.

The leave balance and leave balance summary reports, and balance in the leave application all work fine. The issue is only with the leave application dashboard.

Fix

Don't consider the entire allocation, only consider the ledger entries that fall within that period.

image

@ruchamahabal ruchamahabal requested a review from pateljannat as a code owner June 6, 2022 14:34
@codecov
Copy link

codecov bot commented Jun 6, 2022

Codecov Report

Merging #31253 (719fa43) into develop (c57125a) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

❗ Current head 719fa43 differs from pull request most recent head ef9c34e. Consider uploading reports for the commit ef9c34e to get more accurate results

@@             Coverage Diff             @@
##           develop   #31253      +/-   ##
===========================================
- Coverage    63.49%   63.43%   -0.06%     
===========================================
  Files          986      986              
  Lines        67440    67439       -1     
===========================================
- Hits         42819    42781      -38     
- Misses       24621    24658      +37     
Impacted Files Coverage Δ
.../hr/doctype/leave_application/leave_application.py 82.34% <100.00%> (-0.04%) ⬇️
...tch_item_expiry_status/batch_item_expiry_status.py 67.92% <0.00%> (-24.53%) ⬇️
...wise_balance_history/batch_wise_balance_history.py 67.79% <0.00%> (-22.04%) ⬇️
...rpnext/accounts/doctype/shareholder/shareholder.py 80.00% <0.00%> (-10.00%) ⬇️
...e_sales_analytics/supplier_wise_sales_analytics.py 81.96% <0.00%> (-8.20%) ⬇️
...urity_shortfall/process_loan_security_shortfall.py 93.75% <0.00%> (-6.25%) ⬇️
erpnext/hr/doctype/job_offer/job_offer.py 82.92% <0.00%> (-4.88%) ⬇️
...pnext/setup/doctype/sales_partner/sales_partner.py 65.21% <0.00%> (-4.35%) ⬇️
...e/asset_value_adjustment/asset_value_adjustment.py 86.04% <0.00%> (-3.49%) ⬇️
erpnext/stock/doctype/warehouse/warehouse.py 79.02% <0.00%> (-2.10%) ⬇️
... and 10 more

@ruchamahabal ruchamahabal force-pushed the fix-leave-dashboard branch from 1e47375 to 719fa43 Compare June 6, 2022 15:23
@ruchamahabal ruchamahabal force-pushed the fix-leave-dashboard branch from 719fa43 to b863160 Compare June 7, 2022 03:57
@ruchamahabal
Copy link
Member Author

Unrelated test failure

@ruchamahabal ruchamahabal merged commit 91f9f37 into frappe:develop Jun 7, 2022
@ruchamahabal ruchamahabal deleted the fix-leave-dashboard branch June 7, 2022 04:21
mergify bot pushed a commit that referenced this pull request Jun 7, 2022
…ashboard (#31253)

(cherry picked from commit 91f9f37)

# Conflicts:
#	erpnext/hr/doctype/leave_application/test_leave_application.py
ruchamahabal added a commit that referenced this pull request Jun 7, 2022
…ashboard (backport #31253) (#31256)

fix: leave balance for earned leaves in backdated Leave Application dashboard

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
frappe-pr-bot pushed a commit that referenced this pull request Jun 7, 2022
# [13.33.0](v13.32.0...v13.33.0) (2022-06-07)

### Bug Fixes

* Close unsecured terms loans ([d6d1d79](d6d1d79))
* Consider only Approved leave applications in LWP, Employee Benefit calculations ([7f84c86](7f84c86))
* display currencies in validation message. ([ef22337](ef22337))
* incorrect billed_qty in sales order analysis report when multiple delivery notes for item (backport [#31194](#31194)) ([#31250](#31250)) ([3b1f6da](3b1f6da))
* incorrect LWP calculation for half days in employee benefit application ([10f0c93](10f0c93))
* **India:** GSTIN filter in GSTR-1 report ([abe9fe7](abe9fe7))
* **India:** Supplies from composite dealer not showing up ([15712c7](15712c7))
* **job card:** only hold during draft state (backport [#31243](#31243)) ([#31249](#31249)) ([a7fc278](a7fc278))
* **Leave Application:** 'Cancelled' status shown as 'Open' in list view ([8b48d45](8b48d45))
* leave balance for earned leaves in backdated Leave Application dashboard (backport [#31253](#31253)) ([#31256](#31256)) ([a22d92f](a22d92f))
* only fetch membership expiry if not already set in `member.js` ([#31259](#31259)) ([d433784](d433784))
* Parent dimension filters in orders ([b3cbcd8](b3cbcd8))
* Pluralize year text instead of optional bracket (backport [#31210](#31210)) ([#31212](#31212)) ([b31709c](b31709c))
* re-validate warehouse after 'update items' (backport [#31203](#31203)) ([#31206](#31206)) ([3a718c7](3a718c7))
* remove leave policy assignment creation patch (backport [#31097](#31097)) ([#31204](#31204)) ([4aeb448](4aeb448))
* Remove redundant query ([3c4cf59](3c4cf59))
* Reverse provisional entries on Purchase Invoice cancel ([1fba432](1fba432))
* **Sales Register:** incorrect query with dimensions (backport [#31242](#31242)) ([#31251](#31251)) ([0badfc8](0badfc8))
* Simply cancel reverse entries ([100b8d9](100b8d9))

### Features

* **india:** Improve E-way Bill Cancellation. ([#31088](#31088)) ([622d25e](622d25e))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant