From 6cefdb40d10888fdae9eb833c52da8a9fc34b49e Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Wed, 20 Nov 2019 20:13:04 +0530 Subject: [PATCH] fix(Journal Entry): default Cash Entry account not getting fetched --- .../accounts/doctype/journal_entry/journal_entry.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index 4d0d780f6dc..cbff75f9b7c 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -92,10 +92,10 @@ frappe.ui.form.on("Journal Entry", { multi_currency: function(frm) { erpnext.journal_entry.toggle_fields_based_on_currency(frm); }, - + posting_date: function(frm) { if(!frm.doc.multi_currency || !frm.doc.posting_date) return; - + $.each(frm.doc.accounts || [], function(i, row) { erpnext.journal_entry.set_exchange_rate(frm, row.doctype, row.name); }) @@ -234,7 +234,7 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ out.filters.push([jvd.reference_type, "per_billed", "<", 100]); } - + if(jvd.party_type && jvd.party) { var party_field = ""; if(jvd.reference_type.indexOf("Sales")===0) { @@ -382,7 +382,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) { }); refresh_field("accounts"); } - + if((!(doc.accounts || []).length) || ((doc.accounts || []).length==1 && !doc.accounts[0].account)) { if(in_list(["Bank Entry", "Cash Entry"], doc.voucher_type)) { return frappe.call({ @@ -390,7 +390,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) { method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_default_bank_cash_account", args: { "account_type": (doc.voucher_type=="Bank Entry" ? - "Bank" : (doc.voucher_type=="Cash" ? "Cash" : null)), + "Bank" : (doc.voucher_type=="Cash Entry" ? "Cash" : null)), "company": doc.company }, callback: function(r) { @@ -442,7 +442,7 @@ frappe.ui.form.on("Journal Entry Account", { account: function(frm, dt, dn) { erpnext.journal_entry.set_account_balance(frm, dt, dn); }, - + debit_in_account_currency: function(frm, cdt, cdn) { erpnext.journal_entry.set_exchange_rate(frm, cdt, cdn); },