mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 14:09:19 +00:00
integrated workflow, disable Submit, Cancel if workflow is defined
This commit is contained in:
@@ -32,6 +32,11 @@ class DocType:
|
||||
def validate(self):
|
||||
# if self.doc.exp_approver == self.doc.owner:
|
||||
# webnotes.msgprint("""Self Approval is not allowed.""", raise_exception=1)
|
||||
|
||||
if self.doc.status not in ("Draft", "Approved", "Rejected"):
|
||||
webnotes.msgprint("Status must be one of 'Draft', 'Approved' or 'Rejected'",
|
||||
raise_exception=True)
|
||||
|
||||
self.validate_fiscal_year()
|
||||
self.validate_exp_details()
|
||||
|
||||
|
||||
@@ -55,15 +55,14 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
} else {
|
||||
if(doc.status=="Approved") {
|
||||
cur_frm.set_intro("Leave application has been approved.");
|
||||
if(cur_frm.doc.docstatus==0) {
|
||||
cur_frm.set_intro("Please submit to update Leave Balance.");
|
||||
}
|
||||
} else if(doc.status=="Rejected") {
|
||||
cur_frm.set_intro("Leave application has been rejected.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(doc.status=="Approved" && doc.docstatus==0) {
|
||||
cur_frm.savesubmit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.employee = function (doc, dt, dn){
|
||||
|
||||
@@ -33,6 +33,9 @@ class DocType:
|
||||
def validate(self):
|
||||
# if self.doc.leave_approver == self.doc.owner:
|
||||
# webnotes.msgprint("""Self Approval is not allowed.""", raise_exception=1)
|
||||
if self.doc.status not in ("Open", "Approved", "Rejected"):
|
||||
webnotes.msgprint("Status must be one of 'Open', 'Approved' or 'Rejected'",
|
||||
raise_exception=True)
|
||||
|
||||
self.validate_to_date()
|
||||
self.validate_balance_leaves()
|
||||
|
||||
Reference in New Issue
Block a user