[chart of accounts/cost center] [fix] check permission before enabling add child

This commit is contained in:
Anand Doshi 2013-06-11 17:48:59 +05:30
parent 2e0cc41fc6
commit 0865f60673

View File

@ -131,7 +131,7 @@ erpnext.AccountsChart = Class.extend({
if (wn.model.can_read(this.ctype) !== -1) { if (wn.model.can_read(this.ctype) !== -1) {
node_links.push('<a onclick="erpnext.account_chart.open();">Edit</a>'); node_links.push('<a onclick="erpnext.account_chart.open();">Edit</a>');
} }
if (data.expandable) { if (data.expandable && wn.boot.profile.in_create.indexOf(this.ctype) !== -1) {
node_links.push('<a onclick="erpnext.account_chart.new_node();">Add Child</a>'); node_links.push('<a onclick="erpnext.account_chart.new_node();">Add Child</a>');
} else if (this.ctype === 'Account' && wn.boot.profile.can_read.indexOf("GL Entry") !== -1) { } else if (this.ctype === 'Account' && wn.boot.profile.can_read.indexOf("GL Entry") !== -1) {
node_links.push('<a onclick="erpnext.account_chart.show_ledger();">View Ledger</a>'); node_links.push('<a onclick="erpnext.account_chart.show_ledger();">View Ledger</a>');