fix: calculate earned leaves based on annual allocation
This commit is contained in:
parent
3662ed50d2
commit
261d132f3a
@ -296,12 +296,12 @@ def allocate_earned_leaves():
|
|||||||
if not e_leave_type.earned_leave_frequency == "Monthly":
|
if not e_leave_type.earned_leave_frequency == "Monthly":
|
||||||
if not check_frequency_hit(allocation.from_date, today, e_leave_type.earned_leave_frequency):
|
if not check_frequency_hit(allocation.from_date, today, e_leave_type.earned_leave_frequency):
|
||||||
continue
|
continue
|
||||||
annual_allocation = frappe.get_all("Leave Policy Detail", filters={
|
annual_allocation = frappe.db.get_value("Leave Policy Detail", filters={
|
||||||
'parent': leave_policy.name,
|
'parent': leave_policy.name,
|
||||||
'leave_type': e_leave_type.name
|
'leave_type': e_leave_type.name
|
||||||
}, fields=['annual_allocation'])
|
}, fieldname=['annual_allocation'])
|
||||||
if annual_allocation and annual_allocation[0]:
|
if annual_allocation:
|
||||||
earned_leaves = flt(annual_allocation[0][0]) / divide_by_frequency[e_leave_type.earned_leave_frequency]
|
earned_leaves = flt(annual_allocation) / divide_by_frequency[e_leave_type.earned_leave_frequency]
|
||||||
if e_leave_type.rounding == "0.5":
|
if e_leave_type.rounding == "0.5":
|
||||||
earned_leaves = round(earned_leaves * 2) / 2
|
earned_leaves = round(earned_leaves * 2) / 2
|
||||||
else:
|
else:
|
||||||
|
@ -83,4 +83,4 @@ def get_leaves_application_records():
|
|||||||
def get_leave_encashment_records():
|
def get_leave_encashment_records():
|
||||||
return frappe.get_all("Leave Encashment", filters={
|
return frappe.get_all("Leave Encashment", filters={
|
||||||
"docstatus": 1
|
"docstatus": 1
|
||||||
}, fields=['name', 'employee', 'leave_type', 'encashable_days', 'encashment_date'])
|
}, fields=['name', 'employee', 'leave_type', 'encashable_days', 'encashment_date'])
|
Loading…
Reference in New Issue
Block a user