Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
7370 Zobrazení

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


Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
bře 24
2357
0
čvn 17
3340
2
bře 24
4984
0
úno 21
4625
1
čvn 23
4046