Is there a way to hide the Import button in the tree view for specific groups / users?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
1
Beantwoorden
6863
Weergaven
Place the following code inside the model file:-
@api.model
def fields_view_get(self, view_id=None, view_type='form',
toolbar=False, submenu=False):
result = super(<<<Module Name>>>>, self).fields_view_get(
view_id=view_id, view_type=view_type,
toolbar=toolbar, submenu=submenu)
# Disabling the import button for users who are not in import group
if view_type == 'tree':
doc = etree.XML(result['arch'])
if not self.env.user.has_group('<<<group_id>>>'):
# When the user is not part of the import group
for node in doc.xpath("//tree"):
# Set the import to false
node.set('import', 'false')
result['arch'] = etree.tostring(doc)
return result
Based on the answer here - \https://www.odoo.com/forum/help-1/question/how-to-hide-create-button-in-tree-view-for-all-users-except-one-group-123564
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
Aanmelden