From e6c274f7a31e38ddcb9fc00f4cea64b58346e605 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 31 Oct 2022 08:03:48 +0000 Subject: [PATCH] [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@a468aee5184a62e0dbf0d680036a014079827c2a 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) --- odoo/addons/base/models/res_config.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/odoo/addons/base/models/res_config.py b/odoo/addons/base/models/res_config.py index 9356f2bf86a..520af598eb1 100644 --- a/odoo/addons/base/models/res_config.py +++ b/odoo/addons/base/models/res_config.py @@ -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'):