From ea025d50a1a488d503a9231f9d4a7e2af84788c4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 5 Dec 2012 17:17:00 +0530 Subject: [PATCH] message updates in Leave / Expense, catch localstorage error --- hr/doctype/expense_claim/expense_claim.py | 5 +++++ hr/doctype/leave_application/leave_application.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hr/doctype/expense_claim/expense_claim.py b/hr/doctype/expense_claim/expense_claim.py index bc4e131b53..2495fb4c21 100644 --- a/hr/doctype/expense_claim/expense_claim.py +++ b/hr/doctype/expense_claim/expense_claim.py @@ -28,6 +28,11 @@ class DocType: self.doc = doc self.doclist = doclist + def on_submit(self): + if self.doc.status=="Draft": + webnotes.msgprint("""Please set status to 'Approved' or 'Rejected' before submitting""", + raise_exception=1) + def validate_fiscal_year(self): fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year) ysd=fy and fy[0][0] or "" diff --git a/hr/doctype/leave_application/leave_application.js b/hr/doctype/leave_application/leave_application.js index d550734188..7398c36aff 100755 --- a/hr/doctype/leave_application/leave_application.js +++ b/hr/doctype/leave_application/leave_application.js @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +cur_frm.add_fetch('employee','employee_name','employee_name'); + cur_frm.cscript.onload = function(doc, dt, dn) { if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()}); @@ -51,8 +53,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { } } -cur_frm.add_fetch('employee','employee_name','employee_name'); - cur_frm.cscript.employee = function (doc, dt, dn){ get_leave_balance(doc, dt, dn); }