Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
0029ac9f3c
@ -27,23 +27,23 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
|
|||||||
for(var i = 0; i<val.length; i++){
|
for(var i = 0; i<val.length; i++){
|
||||||
val[i].sanctioned_amount ='';
|
val[i].sanctioned_amount ='';
|
||||||
}
|
}
|
||||||
//doc.total_claimed_amount = '';
|
|
||||||
doc.total_sanctioned_amount = '';
|
doc.total_sanctioned_amount = '';
|
||||||
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
|
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||||
if((user == doc.exp_approver && doc.approval_status == 'Submitted') || doc.docstatus == 0) unhide_field('calculate_total_amount');
|
hide_field('calculate_total_amount');
|
||||||
else hide_field('calculate_total_amount');
|
if(user == doc.exp_approver && doc.approval_status == 'Submitted'){
|
||||||
|
unhide_field(['update_voucher', 'approve', 'reject', 'calculate_total_amount']);
|
||||||
if(user == doc.exp_approver && doc.approval_status == 'Submitted') unhide_field(['update_voucher', 'approve', 'reject']);
|
cur_frm.fields_dict['expense_voucher_details'].grid.set_column_disp('sanctioned_amount', true);
|
||||||
|
set_field_permlevel('remark', 0);
|
||||||
else hide_field(['update_voucher', 'approve', 'reject']);
|
} else {
|
||||||
|
hide_field(['update_voucher', 'approve', 'reject']);
|
||||||
|
cur_frm.fields_dict['expense_voucher_details'].grid.set_column_disp('sanctioned_amount', false);
|
||||||
if(user == doc.exp_approver && doc.approval_status == 'Submitted') set_field_permlevel('remark', 0);
|
set_field_permlevel('remark', 1);
|
||||||
else set_field_permlevel('remark', 1);
|
}
|
||||||
|
if (doc.docstatus == 0) unhide_field('calculate_total_amount');
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.employee = function(doc,cdt,cdn){
|
cur_frm.cscript.employee = function(doc,cdt,cdn){
|
||||||
@ -63,7 +63,9 @@ cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
|
|||||||
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
|
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
|
||||||
var total_claim =0;
|
var total_claim =0;
|
||||||
for(var i = 0; i<val.length; i++){
|
for(var i = 0; i<val.length; i++){
|
||||||
|
if(!doc.claim_amount) val[i].sanctioned_amount = val[i].claim_amount;
|
||||||
total_claim = flt(total_claim)+flt(val[i].claim_amount);
|
total_claim = flt(total_claim)+flt(val[i].claim_amount);
|
||||||
|
refresh_field('sactioned_amount', val[i].name, 'expense_voucher_details');
|
||||||
}
|
}
|
||||||
doc.total_claimed_amount = flt(total_claim);
|
doc.total_claimed_amount = flt(total_claim);
|
||||||
refresh_field('total_claimed_amount');
|
refresh_field('total_claimed_amount');
|
||||||
@ -72,7 +74,10 @@ cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
|
|||||||
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
|
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
|
||||||
var total_sanctioned = 0;
|
var total_sanctioned = 0;
|
||||||
for(var i = 0; i<val.length; i++){
|
for(var i = 0; i<val.length; i++){
|
||||||
|
if(!doc.claim_amount) val[i].sanctioned_amount = val[i].claim_amount;
|
||||||
total_sanctioned = flt(total_sanctioned)+flt(val[i].sanctioned_amount);
|
total_sanctioned = flt(total_sanctioned)+flt(val[i].sanctioned_amount);
|
||||||
|
refresh_field('sactioned_amount', val[i].name, 'expense_voucher_details');
|
||||||
|
|
||||||
}
|
}
|
||||||
doc.total_sanctioned_amount = flt(total_sanctioned);
|
doc.total_sanctioned_amount = flt(total_sanctioned);
|
||||||
refresh_field('total_sanctioned_amount');
|
refresh_field('total_sanctioned_amount');
|
||||||
|
|||||||
@ -98,20 +98,8 @@ class DocType:
|
|||||||
set(self.doc, 'remark', self.doc.remark)
|
set(self.doc, 'remark', self.doc.remark)
|
||||||
set(self.doc, 'approval_status', 'Rejected')
|
set(self.doc, 'approval_status', 'Rejected')
|
||||||
|
|
||||||
# on approval notification
|
|
||||||
#get_obj('Notification Control').notify_contact('Expense Claim Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
|
|
||||||
|
|
||||||
return cstr('Rejected')
|
return cstr('Rejected')
|
||||||
|
|
||||||
def validate_curr_exp(self):
|
|
||||||
for d in getlist(self.doclist, 'expense_voucher_details'):
|
|
||||||
if flt(d.sanctioned_amount) > 0:
|
|
||||||
if self.doc.approval_status == 'Draft':
|
|
||||||
msgprint("Sanctioned amount can be added by Approver person only for submitted Expense Claim")
|
|
||||||
raise Exception
|
|
||||||
elif self.doc.approval_status == 'Submitted' and session['user'] != self.doc.exp_approver:
|
|
||||||
msgprint("Sanctioned amount can be added only by expense voucher Approver")
|
|
||||||
raise Exception
|
|
||||||
|
|
||||||
def validate_fiscal_year(self):
|
def validate_fiscal_year(self):
|
||||||
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
|
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
|
||||||
@ -122,7 +110,6 @@ class DocType:
|
|||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_curr_exp()
|
|
||||||
self.validate_fiscal_year()
|
self.validate_fiscal_year()
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user