From 6b65e2b16886db64add417dd908fbd65a683c855 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Thu, 8 Aug 2019 13:16:35 +0530 Subject: [PATCH] fix: Show Cr or Dr symbol in chart of accounts based on balance (#18652) * fix: Show Cr or Dr symbol in chart of accounts based on balance * Update account_tree.js --- erpnext/accounts/doctype/account/account_tree.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js index 3614881db31..0fd21f81332 100644 --- a/erpnext/accounts/doctype/account/account_tree.js +++ b/erpnext/accounts/doctype/account/account_tree.js @@ -121,7 +121,10 @@ frappe.treeview_settings["Account"] = { }, onrender: function(node) { if(frappe.boot.user.can_read.indexOf("GL Entry") !== -1){ - var dr_or_cr = in_list(["Liability", "Income", "Equity"], node.data.root_type) ? "Cr" : "Dr"; + + // show Dr if positive since balance is calculated as debit - credit else show Cr + let dr_or_cr = node.data.balance_in_account_currency > 0 ? "Dr": "Cr"; + if (node.data && node.data.balance!==undefined) { $('' + (node.data.balance_in_account_currency ?