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: Earned Leave allocation from Leave Policy Assignment #29163

Merged

Conversation

ruchamahabal
Copy link
Member

Problem:

Earned Leave allocation via Leave Policy Assignment is incorrect.

Steps to replicate:

  1. Create a Leave Type for Earned Leave with monthly frequency
    image

  2. Create a Leave Policy with Earned Leave

  3. Create Leave Policy Assignment based on Leave Period. The Leave Allocation created from this assignment should allocate 0 leaves first since it is an Earned Leave and the scheduler will allocate leaves based on the set frequency (eg: if the policy is for 12 earned leaves for Monthly frequency, then the employee should get 0 leaves at first and 1 leave allocated at the end of every month). However, currently, it allocates all 12 leaves on assignment submission.

    earned-leave-bug

Fix:

The get_leaves_for_passed_months does not reset leaves allocated if months passed are 0 i.e if the allocation is done in the first month of the leave period

earned-leave-assignment-corrected

@codecov
Copy link

codecov bot commented Jan 6, 2022

Codecov Report

Merging #29163 (c5d1c30) into develop (fcc5fa1) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop   #29163      +/-   ##
===========================================
+ Coverage    55.78%   55.81%   +0.03%     
===========================================
  Files         1107     1107              
  Lines        67359    67360       +1     
===========================================
+ Hits         37575    37597      +22     
+ Misses       29784    29763      -21     
Impacted Files Coverage Δ
...leave_policy_assignment/leave_policy_assignment.py 85.57% <100.00%> (+0.14%) ⬆️
...ctype/woocommerce_settings/woocommerce_settings.py 80.00% <0.00%> (-4.00%) ⬇️
...e/asset_value_adjustment/asset_value_adjustment.py 86.04% <0.00%> (-3.49%) ⬇️
erpnext/education/doctype/student/student.py 73.68% <0.00%> (-3.16%) ⬇️
...ion/doctype/course_enrollment/course_enrollment.py 44.00% <0.00%> (-2.00%) ⬇️
erpnext/stock/reorder_item.py 75.21% <0.00%> (-1.71%) ⬇️
.../hr/doctype/upload_attendance/upload_attendance.py 44.69% <0.00%> (-1.52%) ⬇️
erpnext/portal/utils.py 28.98% <0.00%> (-1.45%) ⬇️
.../report/stock_projected_qty/stock_projected_qty.py 88.15% <0.00%> (-1.32%) ⬇️
erpnext/accounts/deferred_revenue.py 75.87% <0.00%> (-0.88%) ⬇️
... and 16 more

@ruchamahabal ruchamahabal merged commit 26247be into frappe:develop Jan 6, 2022
@ruchamahabal ruchamahabal deleted the fix-earned-leave-allocation branch January 6, 2022 05:52
@ruchamahabal
Copy link
Member Author

@Mergifyio backport version-13-hotfix version-13-pre-release

mergify bot pushed a commit that referenced this pull request Jan 6, 2022
* fix: Earned Leave allocation from Leave Policy Assignment

* test: Earned Leave Allocation from Leave Policy Assignment

(cherry picked from commit 26247be)
mergify bot pushed a commit that referenced this pull request Jan 6, 2022
* fix: Earned Leave allocation from Leave Policy Assignment

* test: Earned Leave Allocation from Leave Policy Assignment

(cherry picked from commit 26247be)
@mergify
Copy link
Contributor

mergify bot commented Jan 6, 2022

backport version-13-hotfix version-13-pre-release

✅ Backports have been created

ruchamahabal added a commit that referenced this pull request Jan 6, 2022
…29163) (#29165)

* fix: Earned Leave allocation from Leave Policy Assignment

* test: Earned Leave Allocation from Leave Policy Assignment

(cherry picked from commit 26247be)

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
ruchamahabal added a commit that referenced this pull request Jan 6, 2022
…29163) (#29166)

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
conncampbell pushed a commit to conncampbell/erpnext that referenced this pull request Jan 9, 2022
* fix: Earned Leave allocation from Leave Policy Assignment

* test: Earned Leave Allocation from Leave Policy Assignment
conncampbell pushed a commit to conncampbell/erpnext that referenced this pull request Jan 9, 2022
* fix: Earned Leave allocation from Leave Policy Assignment

* test: Earned Leave Allocation from Leave Policy Assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant