Human Resources - Earned Leave Allocation Process Question

Update: I'm willing to sponsor a bounty to get this working if it's a bug, but so far it seems to just not do what it says it is said it will do.  Has anyone else gotten earned leaves to work?  If so, what's the secret ingredient that I'm missing?  

Hello All,

System Info: Ubuntu 20.04 LTS, ERPNext 13.4, Frappe 13.4

I’ve been focused on the HR module in our system for the last few days straight and have noticed a few things that I cannot understand clearly. First, let me preface by sharing that I have read and fully understand the Leave process described in the latest documentation. I’ve also read through many of the existing posts about the leave process and I still haven’t located my answer.

What I’m trying to discover is how and when the earned leave is calculated. I believe that it is run according to the code in the utils.py file in the HR folder.
What isn’t clear to me, after all the reading I’ve done, is when the earned leave is processed and what the specific requirements are for the process to run correctly. Below is what I’ve done to date:


SETUP:

Test User:

1. Created the user as an “employee”

2. Set “Join Date” from May 19th, 2019 This provides two years of working time to use as a test

Attendance:

1. Created Shift Type and named it “Day Shift” for 8 am to 5 pm.

2. Assigned the test user to “Day Shift”

3. Imported Attendance records to the test user for the last two years. Present for 8 hours every weekday on the “Day Shift.”

Leaves:

1. Created a “Casual Leave” Type with these settings;

2. Created several non-earned leaves that are not “carry forward”

3. Created the Leave Periods for the last three calendar years.

4. Created a “Leave Policy” that includes the “Casual Leave” and the other non-earned leaves.

5. Created Leave Policy Assignments for the last two years and assigned the policy to the test user.


RESULTS:

  1. Non-Earned Leaves not carried forward:
    When attempting to allocate consecutive non-earned leaves, the first allocations fail to expire, even if clearly outdated, so the second can not be added. Yet the summary reports are showing the leaves as expired. The only way to allocate additional non-earned leaves is to force expire the leaves inside the DB.

  2. Earned Leaves that are carried forward:
    Allocating additional earned leaves that are carried forward seems to work. But I assume that this is only because they don’t actually get allocated the first time. :slight_smile:

Screenshot of Employee Leave Report: The report shows that none of the Earned leaves have been calculated to date. Since nothing was calculated, nothing carried forward.

In summary, I’m asking what one would need to do to have this show the correct figures. From what I can see I haven’t done anything extraordinary. I’ve just followed the documentation step by step.

This is what leads me to ask “when” the process runs. Because I’m not assuming that it isn’t working at all. Just not yet. :smile:

I’m sure that understanding this process better will help many of the companies using ERPNext be able to plan their HR migrations to complete smoothly.

Thanks in advance!

Hey! I’m having exactly the same problem! Can someone help???

It seems as if the open-source community is struggling as it is very quiet out here in “Discuss.Erpnext” land :frowning:

So I have found someone to provide consulting on the issue and will provide the answer to the question myself. Hopefully, this will answer someone else’s question.

In effect, there is a scheduled process that calculates the “earned leave”. The process runs once a calendar month and only calculates what you have earned in that last month. It then adds that number to a standing total. It will not review your entire history and therefore cannot determine where you should be at the present time unless it has been active for the entire time.

In the example above, I set the periods and police’s up for the last two years and waited to see what would happen. The result was that after one month, I received 1.5 days of earned leave. Nothing was calculated from before. So, if I have no allocated leave from the last month’s run of the process, this month will only calculate what is earned and that will be the total.

Another thing to note is that the calculation isn’t pulling anything from the attendance records. It does mark attendance when any Leave Type is used. However, in the case of an Earned Leave Type, earning the leave is just a simple calculation of time passed, not attendance recorded. I was told that there is no way to shorten the schedule to say a “weekly or daily” timeframe as it was a big process that is resource-intensive.

So the best way to set up an employee migration is to follow these steps

  1. Determine the current amount of leave that an employee has when they are created.

  2. Set a modified “Leave Period” for the remaining time that the employee has to earn new or use existing leaves before the next “normal” leave period would begin.

  3. Perform a manual one-time allocation for those existing leaves.

  4. Create the period, policy, and allocations for the next “normal” cycle that will occur after the “migration transition” period completes.

This is what we will do to get our team working and move on from this

As an aside, I will be looking for someone who can possibly provide a solution that will utilize attendance records to calculate earned leave. It is a common practice for earned leave to be accrued based upon how much a person works not only how much time has passed. If you are a person or team, or know of one, that may be able to help with this type of solution. Please PM me and we can talk.

Cheers for this awesome tool Frappe Team.
Keep up the good work.

I was also under the misconception that everything about leaves aggregation can be simulated and would even show how earned leaves will look like if a person stayed in the company for n number of months, but that’s not the case, a background job runs at the end of the month to update for everyone.

But I don’t think its something that’s worth investing time on by the ERPNext team. HR is a very subjective and humanly intervened domain, its impractical to expect every intricacy to be modelled efficiently in code, and it makes more sense to just manually add all the accumulated leaves of a company before moving to ERPNext and then adopt the ERPNext standard, instead of ERPNext having to account for everyone’s previous baggage. Just my 2 cents.