Merge pull request #300 from mayur-patel/master
Allow user to add leave application which may results in negative balance.
This commit is contained in:
commit
c4529ebb0d
@ -126,8 +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.
|
||||||
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=not(webnotes.conn.get_value("Leave Type", self.doc.leave_type,"allow_negative") or None))
|
||||||
|
|
||||||
def validate_leave_overlap(self):
|
def validate_leave_overlap(self):
|
||||||
if not self.doc.name:
|
if not self.doc.name:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:15",
|
"creation": "2013-02-21 09:55:58",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-22 14:47:02",
|
"modified": "2013-03-05 08:06:43",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -91,6 +91,12 @@
|
|||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Is LWP"
|
"label": "Is LWP"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "allow_negative",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Allow Negative Balance"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"role": "System Manager"
|
"role": "System Manager"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user