[FIX] base: remove useless res.config.settings _get_view override
The code removed by this revision was added at a time any user could access the `res.config.settings` model, including non-admins. odoo/odoo@a468aee518 So, it made sense at the time to make the module installation checkboxes readonly for non-admin users accessing the settings. However, since revision https://github.com/odoo/odoo/commit/65530dfd6a0486f44134917f5cc42a2c30b95762#diff-e275aaa5de11da2815c2f0cc18bc046f967df5e4eba94999ee55ffe8926c87bdR109 the `res.config.settings` model is restricted to admins only, who have the write access the `ir.module.module` model. This override is therefore pointless, as since then it's impossible for non-admins to access the settings. closes odoo/odoo#105254 X-original-commit: d43896c0bb88310ec2bbb87c4dc355d2bd7faad9 Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
This commit is contained in:
@@ -383,24 +383,6 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin)
|
||||
def copy(self, default=None):
|
||||
raise UserError(_("Cannot duplicate configuration!"))
|
||||
|
||||
@api.model
|
||||
def _get_view(self, view_id=None, view_type='form', **options):
|
||||
arch, view = super()._get_view(view_id, view_type, **options)
|
||||
|
||||
can_install_modules = self.env['ir.module.module'].check_access_rights(
|
||||
'write', raise_exception=False)
|
||||
|
||||
for node in arch.xpath("//field[@name]"):
|
||||
if not node.get('name').startswith("module_"):
|
||||
continue
|
||||
if not can_install_modules:
|
||||
node.set("readonly", "1")
|
||||
modifiers = json.loads(node.get("modifiers"))
|
||||
modifiers['readonly'] = True
|
||||
node.set("modifiers", json.dumps(modifiers))
|
||||
|
||||
return arch, view
|
||||
|
||||
def onchange_module(self, field_value, module_name):
|
||||
module_sudo = self.env['ir.module.module']._get(module_name[7:])
|
||||
if not int(field_value) and module_sudo.state in ('to install', 'installed', 'to upgrade'):
|
||||
|
||||
Reference in New Issue
Block a user