mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
fixed: hide links based on roles in accounts home
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
<p class="help">Bills raised by Suppliers</p>
|
<p class="help">Bills raised by Suppliers</p>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 48%; float: right;">
|
<div style="width: 48%; float: right;">
|
||||||
<h4><a href="#!Accounts Browser/Account">Chart of Accounts</a></h4>
|
<h4><a href="#!Accounts Browser/Account" data-role="Accounts Manager, Accounts User">Chart of Accounts</a></h4>
|
||||||
<p class="help">Structure of books of accounts</p>
|
<p class="help">Structure of books of accounts</p>
|
||||||
<br>
|
<br>
|
||||||
<h4><a href="#!Accounts Browser/Cost Center">Chart of Cost Centers</a></h4>
|
<h4><a href="#!Accounts Browser/Cost Center">Chart of Cost Centers</a></h4>
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
href="#!Financial Statements">Financial Statements</a>
|
href="#!Financial Statements">Financial Statements</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="section-item">
|
<div class="section-item">
|
||||||
<a class="section-link"
|
<a class="section-link" data-role="Accounts Manager"
|
||||||
title = "Import Multiple Vouchers from CSV"
|
title = "Import Multiple Vouchers from CSV"
|
||||||
href="#voucher-import-tool">Voucher Import Tool</a>
|
href="#voucher-import-tool">Voucher Import Tool</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,11 +22,4 @@ pscript['onload_accounts-home'] = function(wrapper) {
|
|||||||
$('.india-specific').toggle(false);
|
$('.india-specific').toggle(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(wn.boot.profile.roles.indexOf('Accounts Manager')==-1 && wn.boot.profile.roles.indexOf('Accounts User')==-1) {
|
|
||||||
$('[href*="Accounts Browser"]').each(function() {
|
|
||||||
var txt = $(this).text();
|
|
||||||
$(this).parent().css('color', '#999').html(txt);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,10 @@ erpnext.module_page.hide_links = function(wrapper) {
|
|||||||
|
|
||||||
// pages
|
// pages
|
||||||
$(wrapper).find('[data-role]').each(function() {
|
$(wrapper).find('[data-role]').each(function() {
|
||||||
if(!has_common(user_roles, [$(this).attr("data-role"), "System Manager"])) {
|
// can define multiple roles
|
||||||
|
var data_roles = $(this).attr("data-role").split(",").map(function(role) {
|
||||||
|
return role.trim(); });
|
||||||
|
if(!has_common(user_roles, ["System Manager"].concat(data_roles))) {
|
||||||
var html = $(this).html();
|
var html = $(this).html();
|
||||||
$(this).parent().css('color', '#999');
|
$(this).parent().css('color', '#999');
|
||||||
$(this).replaceWith('<span title="Only accessible by Roles: '+
|
$(this).replaceWith('<span title="Only accessible by Roles: '+
|
||||||
|
|||||||
Reference in New Issue
Block a user