[fix] fetch bank/cash account
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index fe533e2..5ff9e5f 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -225,7 +225,7 @@
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.cash_bank_account;
+ row.account = d.account;
row.balance = d.balance;
});
refresh_field("accounts");
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 8160850..0bd2307 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -452,8 +452,8 @@
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
if mode_of_payment:
account = get_bank_cash_account(mode_of_payment, company)
- if account.get("bank_cash_account"):
- account.update({"balance": get_balance_on(account.get("bank_cash_account"))})
+ if account.get("account"):
+ account.update({"balance": get_balance_on(account.get("account"))})
return account
if voucher_type=="Bank Entry":
@@ -467,7 +467,7 @@
if account:
return {
- "cash_bank_account": account,
+ "account": account,
"balance": get_balance_on(account)
}
@@ -524,7 +524,7 @@
d2 = jv.append("accounts")
if bank_account:
- d2.account = bank_account["cash_bank_account"]
+ d2.account = bank_account["account"]
d2.balance = bank_account["balance"]
return jv
diff --git a/erpnext/accounts/doctype/payment_tool/payment_tool.js b/erpnext/accounts/doctype/payment_tool/payment_tool.js
index 7224f3b..cff0bd2 100644
--- a/erpnext/accounts/doctype/payment_tool/payment_tool.js
+++ b/erpnext/accounts/doctype/payment_tool/payment_tool.js
@@ -74,10 +74,9 @@
"mode_of_payment": frm.doc.payment_mode,
"company": frm.doc.company
},
- callback: function(r, rt) {
+ callback: function(r, rt) {
if(r.message) {
- frm.doc.set_value("payment_account", r.message['bank_cash_account']
-);
+ cur_frm.set_value("payment_account", r.message['account']);
}
}
});
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 36d8fdd..96b47c6 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -253,6 +253,12 @@
"mode_of_payment": doc.mode_of_payment,
"company": doc.company
},
+ callback: function(r, rt) {
+ if(r.message) {
+ cur_frm.set_value("cash_bank_account", r.message["account"]);
+ }
+
+ }
});
}
}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 17c3739..9568c90 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -590,12 +590,12 @@
@frappe.whitelist()
def get_bank_cash_account(mode_of_payment, company):
- account = frappe.db.get_value("Mode of Payment Account", {"parent": mode_of_payment, "company": company}, \
- "default_account")
+ account = frappe.db.get_value("Mode of Payment Account",
+ {"parent": mode_of_payment, "company": company}, "default_account")
if not account:
frappe.msgprint(_("Please set default Cash or Bank account in Mode of Payment {0}").format(mode_of_payment))
return {
- "cash_bank_account": account
+ "account": account
}