[fix] [minor] Do not validate leave balance if status is Rejected

This commit is contained in:
Nabin Hait 2013-08-12 15:29:50 +05:30
parent 9fa830805e
commit 37fe72e4e9

View File

@ -115,7 +115,8 @@ class DocType(DocListController):
self.doc.leave_balance = get_leave_balance(self.doc.employee,
self.doc.leave_type, self.doc.fiscal_year)["leave_balance"]
if self.doc.leave_balance - self.doc.total_leave_days < 0:
if self.doc.status != "Rejected" \
and self.doc.leave_balance - self.doc.total_leave_days < 0:
#check if this leave type allow the remaining balance to be in negative. If yes then warn the user and continue to save else warn the user and don't save.
msgprint("There is not enough leave balance for Leave Type: %s" % \
(self.doc.leave_type,),