Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait
2012-12-28 16:46:48 +05:30
10 changed files with 78 additions and 55 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

@@ -47,20 +47,22 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
} else {
cur_frm.set_intro("This Leave Application is pending approval. Only the Leave Apporver can update status.")
cur_frm.toggle_enable("status", false);
if(!doc.__islocal) cur_frm.frm_head.appframe.buttons.Submit.remove();
if(!doc.__islocal) {
if(cur_frm.frm_head.appframe.buttons.Submit)
cur_frm.frm_head.appframe.buttons.Submit.remove();
}
}
} 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()