fix: Handle the "no leave_allocation found" case (#23920)

This commit is contained in:
Suraj Shetty
2020-11-17 12:07:53 +05:30
committed by GitHub
parent 789f1007b9
commit fe56015cbf

View File

@@ -95,7 +95,11 @@ class LeaveEncashment(Document):
create_leave_ledger_entry(self, args, submit)
# create reverse entry for expired leaves
to_date = self.get_leave_allocation().get('to_date')
leave_allocation = self.get_leave_allocation()
if not leave_allocation:
return
to_date = leave_allocation.get('to_date')
if to_date < getdate(nowdate()):
args = frappe._dict(
leaves=self.encashable_days,