[enhancement] Expense Claim - View Bank Entries

This commit is contained in:
Anand Doshi 2016-02-15 18:02:23 +05:30
parent 6921894f8e
commit 5f72504de1

View File

@ -92,14 +92,26 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
cur_frm.toggle_enable("exp_approver", doc.approval_status=="Draft");
cur_frm.toggle_enable("approval_status", (doc.exp_approver==user && doc.docstatus==0));
if(doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
if (doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
cur_frm.savesubmit();
if(doc.docstatus==1 && frappe.model.can_create("Journal Entry") && doc.approval_status=="Approved" &&
cint(doc.total_amount_reimbursed) < cint(doc.total_sanctioned_amount))
cur_frm.add_custom_button(__("Bank Entry"),
cur_frm.cscript.make_bank_entry, __("Make"));
if (doc.docstatus===1 && doc.approval_status=="Approved") {
if (cint(doc.total_amount_reimbursed) < cint(doc.total_sanctioned_amount) && frappe.model.can_create("Journal Entry")) {
cur_frm.add_custom_button(__("Bank Entry"), cur_frm.cscript.make_bank_entry, __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
}
if (cint(doc.total_amount_reimbursed) > 0 && frappe.model.can_read("Journal Entry")) {
cur_frm.add_custom_button(__('Bank Entries'), function() {
frappe.route_options = {
"Journal Entry Account.reference_type": me.frm.doc.doctype,
"Journal Entry Account.reference_name": me.frm.doc.name,
company: me.frm.doc.company
};
frappe.set_route("List", "Journal Entry");
}, __("View"));
}
}
}
}