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

This commit is contained in:
Suraj Shetty
2020-11-17 11:02:15 +05:30
committed by GitHub
parent 26b802d44a
commit 780982dcc7

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,