mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
if total leave days is 0, do not allow leave application to be saved
This commit is contained in:
@@ -117,7 +117,12 @@ class DocType:
|
|||||||
self.doc.leave_balance = get_leave_balance(self.doc.employee,
|
self.doc.leave_balance = get_leave_balance(self.doc.employee,
|
||||||
self.doc.leave_type, self.doc.fiscal_year)["leave_balance"]
|
self.doc.leave_type, self.doc.fiscal_year)["leave_balance"]
|
||||||
self.doc.total_leave_days = self.get_total_leave_days()["total_leave_days"]
|
self.doc.total_leave_days = self.get_total_leave_days()["total_leave_days"]
|
||||||
|
|
||||||
|
if self.doc.total_leave_days == 0:
|
||||||
|
msgprint(_("Hurray! The day(s) on which you are applying for leave \
|
||||||
|
coincide with holiday(s). You need not apply for leave."),
|
||||||
|
raise_exception=1)
|
||||||
|
|
||||||
if self.doc.leave_balance - self.doc.total_leave_days < 0:
|
if self.doc.leave_balance - self.doc.total_leave_days < 0:
|
||||||
msgprint("There is not enough leave balance for Leave Type: %s" % \
|
msgprint("There is not enough leave balance for Leave Type: %s" % \
|
||||||
(self.doc.leave_type,), raise_exception=1)
|
(self.doc.leave_type,), raise_exception=1)
|
||||||
|
|||||||
Reference in New Issue
Block a user