Merge pull request #5147 from vjFaLk/leave-allocation-fix

[Fix] Leave Allocation now includes To Date in Difference
This commit is contained in:
Anand Doshi 2016-04-07 16:53:29 +05:30
commit 1f2f82fcc2

View File

@ -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):