Skip to content

Commit

Permalink
fix: create single leave ledger entry for encashment if leave is carr…
Browse files Browse the repository at this point in the history
…y forward type.
  • Loading branch information
asmitahase committed Jan 10, 2025
1 parent ff20980 commit acd618f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hrms/hr/doctype/leave_encashment/leave_encashment.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,14 @@ def create_leave_ledger_entry(self, submit=True):
return

to_date = leave_allocation.get("to_date")
if to_date < getdate():

can_expire = not frappe.db.get_value("Leave Type",self.leave_type,"is_carry_forward")
if to_date < getdate() and can_expire:
args = frappe._dict(
leaves=self.encashment_days, from_date=to_date, to_date=to_date, is_carry_forward=0
)
create_leave_ledger_entry(self, args, submit)


def create_leave_encashment(leave_allocation):
"""Creates leave encashment for the given allocations"""
for allocation in leave_allocation:
Expand Down

0 comments on commit acd618f

Please sign in to comment.