fix in chart of accounts balance display
diff --git a/accounts/page/accounts_browser/accounts_browser.js b/accounts/page/accounts_browser/accounts_browser.js
index 6fd0c66..97c8554 100644
--- a/accounts/page/accounts_browser/accounts_browser.js
+++ b/accounts/page/accounts_browser/accounts_browser.js
@@ -109,11 +109,11 @@
},
onrender: function(treenode) {
- if (ctype == 'Account') {
- var bal = treenode.data && treenode.data.balance.split(' ') || ['',''];
- if (bal && flt(bal[1])) {
+ if (ctype == 'Account' && treenode.data) {
+ if(treenode.data.balance) {
treenode.parent.append('<span class="balance-area">'
- + format_currency(bal[1], bal[0]) + '</span>');
+ + format_currency(treenode.data.balance, treenode.data.currency)
+ + '</span>');
}
}
}
diff --git a/accounts/page/accounts_browser/accounts_browser.py b/accounts/page/accounts_browser/accounts_browser.py
index 68f8357..d78b8a2 100644
--- a/accounts/page/accounts_browser/accounts_browser.py
+++ b/accounts/page/accounts_browser/accounts_browser.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
import webnotes
import webnotes.defaults
-
+from webnotes.utils import flt
from accounts.utils import get_balance_on
@webnotes.whitelist()
@@ -53,6 +53,7 @@
currency = webnotes.conn.sql("select default_currency from `tabCompany` where name = %s", company)[0][0]
for each in acc:
bal = get_balance_on(each.get("value"))
- each['balance'] = currency + ' ' + str(bal or 0)
+ each["currency"] = currency
+ each["balance"] = flt(bal)
return acc