mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
changed the logic to be more elegant.
This commit is contained in:
@@ -126,13 +126,10 @@ class DocType(DocListController):
|
|||||||
self.doc.leave_type, self.doc.fiscal_year)["leave_balance"]
|
self.doc.leave_type, self.doc.fiscal_year)["leave_balance"]
|
||||||
|
|
||||||
if self.doc.leave_balance - self.doc.total_leave_days < 0:
|
if 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.
|
||||||
# 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" % \
|
||||||
if webnotes.conn.get_value("Leave Type", self.doc.leave_type,"allow_negative"):
|
(self.doc.leave_type,),
|
||||||
msgprint("There is not enough leave balance for Leave Type - new: %s" %(self.doc.leave_type,))
|
raise_exception=not(webnotes.conn.get_value("Leave Type", self.doc.leave_type,"allow_negative") or None))
|
||||||
# warn the user but don't save the form.
|
|
||||||
else:
|
|
||||||
msgprint("There is not enough leave balance for Leave Type - new: %s" %(self.doc.leave_type,), raise_exception=1)
|
|
||||||
|
|
||||||
def validate_leave_overlap(self):
|
def validate_leave_overlap(self):
|
||||||
if not self.doc.name:
|
if not self.doc.name:
|
||||||
|
|||||||
Reference in New Issue
Block a user