Earned Leave Not Calculating

Hello , I am using ERPNext v13.13 ( self hosted ) and i am testing out with a dummy entry and unable to calculate earned leave.
image

I have created a user with Date of employment as 24th April 2021.

I have defined leave type to allocate 0.5 per month after 92 days from employment.

leave period is defined from 1st Jan 2021 to 31st Dec 2021.

Leave policy is defined to leave type as well.

Leave policy is assigned and submitted to employee based on “joining date”

I think in version 13, leave allocation is automatically created when leave policy is assigned and submitted as i do not find the “Grand Leave” button.

However, in total leave allocated, it still appear as 0. instead of calculating 1.5days based on “leave type defination” ( till 2nd nov 2021 ).

if we look at the leave balance summary , it is showing 0.

May i know what have i done wrong or is there anything i fail to define?

I think this is related to not having a holiday list configured and assigned to the company/user.

Hello @conncampbell i realized something, if i assign leave based on “Leave Period” , it will calculate.


although calculation is wrong. It should be applicable after 92 days from employment, so it should be 2 days instead of 3.5 day.

However, if i choose “joining date” in leave policy assignment, it do not calculate.


1 Like

Based on above post, may i know how do i ensure leave "applicable After ( Working Days ) is considered in the auto calculation?

“Applicable after” blocks users from applying for leave until 92 WORKING days after joining. So it excludes any previously approved leave days. For allocation calculation, this field has no part in the calculation.

As for getting zero leaves allocated when set to “Joining Date”, the code does indeed specifically set the allocation to zero:

elif leave_type_details.get(leave_type).is_earned_leave == 1:
if self.assignment_based_on == “Leave Period”:
new_leaves_allocated = self.get_leaves_for_passed_months(leave_type, new_leaves_allocated, leave_type_details, date_of_joining)
else:
new_leaves_allocated = 0

I’m not sure why, I suspect a bug. You can submit bug reports on github.

I hope this helps…

2 Likes