Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
7334 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
mrt. 24
2343
0
jun. 17
3333
2
mrt. 24
4954
0
feb. 21
4612
1
jun. 23
4029