From 9919a0a9db4bbc0f3019651c3357b28a747d0585 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 16 Sep 2016 16:21:36 +0530 Subject: [PATCH] [fix] #5992 --- erpnext/accounts/doctype/journal_entry/journal_entry.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index 13f2f61971..ced56d08c9 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -259,7 +259,6 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) { if(!doc.company) return; var update_jv_details = function(doc, r) { - var jvdetail = frappe.model.add_child(doc, "Journal Entry Account", "accounts"); $.each(r, function(i, d) { var row = frappe.model.add_child(doc, "Journal Entry Account", "accounts"); row.account = d.account; @@ -267,8 +266,8 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) { }); refresh_field("accounts"); } - - if(!(doc.accounts || []).length) { + + 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({ type: "GET",