Browse Source

[FIX] odoo_readonly_user: fix the check mode default to "read"

pull/331/head
Mahdi BERRANEM 7 months ago
parent
commit
eda9cf6d7e
  1. 8
      odoo_readonly_user/models/ir_model_access.py

8
odoo_readonly_user/models/ir_model_access.py

@ -28,15 +28,15 @@ class IrModelAccess(models.Model):
_inherit = 'ir.model.access'
@api.model
def check(self, model_name, mode='read', raise_exception=True):
def check(self, model, mode='read', raise_exception=True):
"""Overrides the default check method to allow
only read access to the user."""
model = ['res.users.log', 'mail.channel', 'mail.alias',
model_name = ['res.users.log', 'mail.channel', 'mail.alias',
'bus.presence', 'res.lang',
'mail.channel.member']
res = super().check(model_name, mode='read', raise_exception=raise_exception)
res = super().check(model, mode, raise_exception=raise_exception)
if self.env.user.has_group('odoo_readonly_user.group_users_readonly') \
and model_name not in model and mode in (
and model not in model_name and mode in (
'write', 'create', 'unlink'):
return False
return res

Loading…
Cancel
Save