Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7341 มุมมอง

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


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มี.ค. 24
2348
0
มิ.ย. 17
3336
2
มี.ค. 24
4958
0
ก.พ. 21
4617
1
มิ.ย. 23
4032