[enhancement] Expense Claim - View Bank Entries
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index c486391..16e78a6 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -92,14 +92,26 @@
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"));
+ }
+ }
}
}