[accounts] [feature] added default_cash_account in company and gets set in Journal Voucher
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
index 811bc50..4edbed5 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -153,7 +153,8 @@
callback: function(r) {
if(r.message) {
var jvdetail = wn.model.add_child(doc, "Journal Voucher Detail", "entries");
- jvdetail.account = r.message || "";
+ jvdetail.account = r.message.account;
+ jvdetail.balance = r.message.balance;
refresh_field("entries");
}
}
diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py
index 4078701..812ab7d 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/accounts/doctype/journal_voucher/journal_voucher.py
@@ -351,8 +351,14 @@
@webnotes.whitelist()
def get_default_bank_cash_account(company, voucher_type):
- return webnotes.conn.get_value("Company", company,
+ from accounts.utils import get_balance_on
+ account = webnotes.conn.get_value("Company", company,
voucher_type=="Bank Voucher" and "default_bank_account" or "default_cash_account")
+ if account:
+ return {
+ "account": account,
+ "balance": get_balance_on(account)
+ }
def get_against_purchase_invoice(doctype, txt, searchfield, start, page_len, filters):
return webnotes.conn.sql("""select name, credit_to, outstanding_amount, bill_no, bill_date