allow expense claim sanctioned amount to have 0 value

This commit is contained in:
Anand Doshi 2012-11-06 14:37:18 +05:30
parent 48d253fec7
commit d871145346
2 changed files with 13 additions and 3 deletions

View File

@ -46,6 +46,13 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
if (doc.docstatus == 0) unhide_field('calculate_total_amount');
}
cur_frm.cscript.validate = function(doc) {
if(cint(doc.docstatus) == 0) {
doc.approval_status = "Draft";
}
cur_frm.cscript.calculate_total(doc);
}
cur_frm.cscript.employee = function(doc,cdt,cdn){
if(doc.employee){
$c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){

View File

@ -77,10 +77,13 @@ class DocType:
set(self.doc, 'remark', self.doc.remark)
def approve_voucher(self):
missing_count = 0
for d in getlist(self.doclist, 'expense_voucher_details'):
if not d.sanctioned_amount:
msgprint("Please add 'Sanctioned Amount' for all expenses")
return cstr('Incomplete')
missing_count += 1
if missing_count == len(getlist(self.doclist, 'expense_voucher_details')):
msgprint("Please add 'Sanctioned Amount' for atleast one expense")
return cstr('Incomplete')
if not self.doc.total_sanctioned_amount:
msgprint("Please calculate total sanctioned amount using button 'Calculate Total Amount'")
@ -112,7 +115,7 @@ class DocType:
def validate(self):
self.validate_fiscal_year()
def on_update(self):
set(self.doc, 'approval_status', 'Draft')