diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js index 5bc2e3588e..8f07ef584e 100644 --- a/erpnext/accounts/page/accounts_browser/accounts_browser.js +++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js @@ -120,15 +120,23 @@ erpnext.AccountsChart = Class.extend({ if(!data) return; link.toolbar = $('').insertAfter(link); + + var node_links = []; // edit - $('Edit').appendTo(link.toolbar); - - if(data.expandable) { - link.toolbar.append(' | Add Child'); - } else if(this.ctype=='Account') { - link.toolbar.append(' | View Ledger'); + if (wn.boot.profile.can_read.indexOf(this.ctype) !== -1) { + node_links.push('Edit'); } + if (data.expandable) { + if (wn.boot.profile.can_create.indexOf(this.ctype) !== -1 || + wn.boot.profile.in_create.indexOf(this.ctype) !== -1) { + node_links.push('Add Child'); + } + } else if (this.ctype === 'Account' && wn.boot.profile.can_read.indexOf("GL Entry") !== -1) { + node_links.push('View Ledger'); + } + + link.toolbar.append(node_links.join(" | ")); }, show_ledger: function() { var me = this;