From c33e96f860d8f106aece0df149ae20de6a2af4ac Mon Sep 17 00:00:00 2001 From: Valmik Jangla Date: Thu, 7 Apr 2016 12:02:31 +0530 Subject: [PATCH] Leave Allocation Fix --- erpnext/hr/doctype/leave_allocation/leave_allocation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.py b/erpnext/hr/doctype/leave_allocation/leave_allocation.py index 6740c6e9a4..331a82bd8a 100755 --- a/erpnext/hr/doctype/leave_allocation/leave_allocation.py +++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.py @@ -77,7 +77,9 @@ class LeaveAllocation(Document): frappe.throw(_("Total leaves allocated is mandatory")) def validate_total_leaves_allocated(self): - if date_diff(self.to_date, self.from_date) <= flt(self.total_leaves_allocated): + # Adding a day to include To Date in the difference + date_difference = date_diff(self.to_date, self.from_date) + 1 + if date_difference < self.total_leaves_allocated: frappe.throw(_("Total allocated leaves are more than days in the period"), OverAllocationError) def validate_against_leave_applications(self):