From 0f458b1260ee38cb90405b443177a0105eb33d3c Mon Sep 17 00:00:00 2001 From: Zarrar Date: Tue, 9 Jan 2018 11:27:14 +0530 Subject: [PATCH] show balance if permitted to view gl entry (#12385) --- .../accounts/doctype/account/account_tree.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js index 2f4e09b53c..9f06ada260 100644 --- a/erpnext/accounts/doctype/account/account_tree.js +++ b/erpnext/accounts/doctype/account/account_tree.js @@ -79,15 +79,17 @@ frappe.treeview_settings["Account"] = { }, onrender: function(node) { - var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr"; - if (node.data && node.data.balance!==undefined) { - $('' - + (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 - + '').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) { + $('' + + (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 + + '').insertBefore(node.$ul); + } } }, toolbar: [