Route to Payment Entry instead of Journal Entry in paid Expense Claim (#11874)

* route fixed

* improvised
This commit is contained in:
Shreya Shah 2017-12-08 16:14:23 +05:30 committed by Nabin Hait
parent 17fd6610dc
commit 6b64947f47

View File

@ -83,15 +83,26 @@ cur_frm.cscript.refresh = function(doc) {
if (doc.docstatus===1 && doc.approval_status=="Approved") {
/* eslint-disable */
// no idea how `me` works here
if (cint(doc.total_amount_reimbursed) > 0 && frappe.model.can_read("Journal Entry")) {
// no idea how `me` works here
var entry_doctype, entry_reference_doctype, entry_reference_name;
if(doc.__onload.make_payment_via_journal_entry){
entry_doctype = "Journal Entry";
entry_reference_doctype = "Journal Entry Account.reference_type";
entry_reference_name = "Journal Entry.reference_name";
} else {
entry_doctype = "Payment Entry";
entry_reference_doctype = "Payment Entry Reference.reference_doctype";
entry_reference_name = "Payment Entry Reference.reference_name";
}
if (cint(doc.total_amount_reimbursed) > 0 && frappe.model.can_read(entry_doctype)) {
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,
entry_route_doctype: me.frm.doc.doctype,
entry_route_name: me.frm.doc.name,
company: me.frm.doc.company
};
frappe.set_route("List", "Journal Entry");
frappe.set_route("List", entry_doctype);
}, __("View"));
}
/* eslint-enable */