Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
7356 Lượt xem

Hi,
I have created a user group, for which I want to give readonly permissions. So if the User with that group tries to edit any of the records in odoo, I want to raise an AccessError(A warning). If there is any base function, which can be overriden to make these ?


kindly Regards,
Muhsin K


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Muhsin,

You can add a constraint on the field using api.constraint.

Please see below piece of code for the same:

@api.constraint('field_name')
def check_group_access(self):
if self.env.user.has_group('account.group_account_invoice'):
raise AccessError(_("You don't have the access rights to edit this."))

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 24
2350
0
thg 6 17
3339
2
thg 3 24
4968
0
thg 2 21
4621
1
thg 6 23
4037