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
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
1
Trả lời
6833
Lượt xem
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
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký