From 5cdda19494dd04f046b0ad1a2aace0e5a0a0897c Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Tue, 20 Aug 2019 13:02:40 +0530 Subject: [PATCH] fix: ledger entries after expiry --- erpnext/patches/v12_0/generate_leave_ledger_entries.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v12_0/generate_leave_ledger_entries.py b/erpnext/patches/v12_0/generate_leave_ledger_entries.py index 44b59bf09b..5e91449c3e 100644 --- a/erpnext/patches/v12_0/generate_leave_ledger_entries.py +++ b/erpnext/patches/v12_0/generate_leave_ledger_entries.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe -from frappe.utils import getdate +from frappe.utils import getdate, today def execute(): """ Generates leave ledger entries for leave allocation/application/encashment @@ -66,7 +66,8 @@ def generate_expiry_allocation_ledger_entries(): if not frappe.db.exists("Leave Ledger Entry", {'transaction_type': 'Leave Allocation', 'transaction_name': allocation.name, 'is_expired': 1}): allocation.update(dict(doctype="Leave Allocation")) allocation_obj = frappe.get_doc(allocation) - expire_allocation(allocation_obj) + if allocation_obj.to_date <= getdate(today()): + expire_allocation(allocation_obj) def get_allocation_records(): return frappe.get_all("Leave Allocation", filters={