integrated workflow, disable Submit, Cancel if workflow is defined

This commit is contained in:
Rushabh Mehta
2012-12-28 16:07:55 +05:30
parent 5a3cbd8700
commit 4337802cdb
6 changed files with 49 additions and 31 deletions

View File

@@ -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()

View File

@@ -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){

View File

@@ -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()