show balance if permitted to view gl entry (#12385)
diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js
index 2f4e09b..9f06ada 100644
--- a/erpnext/accounts/doctype/account/account_tree.js
+++ b/erpnext/accounts/doctype/account/account_tree.js
@@ -79,15 +79,17 @@
},
onrender: function(node) {
- var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr";
- if (node.data && node.data.balance!==undefined) {
- $('<span class="balance-area pull-right text-muted small">'
- + (node.data.balance_in_account_currency ?
- (format_currency(Math.abs(node.data.balance_in_account_currency),
- node.data.account_currency) + " / ") : "")
- + format_currency(Math.abs(node.data.balance), node.data.company_currency)
- + " " + dr_or_cr
- + '</span>').insertBefore(node.$ul);
+ if(frappe.boot.user.can_read.indexOf("GL Entry") !== -1){
+ var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr";
+ if (node.data && node.data.balance!==undefined) {
+ $('<span class="balance-area pull-right text-muted small">'
+ + (node.data.balance_in_account_currency ?
+ (format_currency(Math.abs(node.data.balance_in_account_currency),
+ node.data.account_currency) + " / ") : "")
+ + format_currency(Math.abs(node.data.balance), node.data.company_currency)
+ + " " + dr_or_cr
+ + '</span>').insertBefore(node.$ul);
+ }
}
},
toolbar: [