Skip to content

Leave Allocation Builder

Jamsheer PP edited this page Mar 9, 2022 · 6 revisions

At first, go through core features of Leave Allocation in ERPNext.

Automate the Leave Allocation based on the Leave Policy applicable to each Employee (Leave Policy set in the Employee master).

  • Create leave allocation for employees, who is having a valid leave policy.
  • If no leave policy is configured in the employee, get leave policy configured in employee grade for the employee.
  • Iterate Leave policy details to check if there any Leave Allocation exists, if not then it will create leave allocation.
    • Find from_date and to_date to get leave allocation for the current leave period
    • If the date of joining + 1 year greater than today, then from_date will be the joining date.
    • Else, from_date will be the sum of joining date and difference in years between the date of joining and today.
    • to_date is a year of addition to the from date
    • Check allocation exists for leave type in leave Policy, If not then create leave allocation
  • Earned Leaves and Compensatory Leaves are allocated by scheduler, initially allocate 0
  • Annual Leave allocated by scheduler, initially allocate 0
  • Hajj Leave is allocated for employees who do not perform hajj before
Clone this wiki locally