diff --git a/odoo/addons/base/i18n/base.pot b/odoo/addons/base/i18n/base.pot index 2f11cc7427c..198c0fa7b7d 100644 --- a/odoo/addons/base/i18n/base.pot +++ b/odoo/addons/base/i18n/base.pot @@ -31914,6 +31914,15 @@ msgstr "" msgid "You cannot delete the %s record." msgstr "" +#. module: base +#. odoo-python +#: code:addons/base/models/res_users.py:0 +#, python-format +msgid "" +"You cannot delete the admin user because it is utilized in various places " +"(such as security configurations,...). Instead, archive it." +msgstr "" + #. module: base #. odoo-python #: code:addons/base/models/res_lang.py:0 diff --git a/odoo/addons/base/models/res_users.py b/odoo/addons/base/models/res_users.py index 141aeec193e..49faa4d71ab 100644 --- a/odoo/addons/base/models/res_users.py +++ b/odoo/addons/base/models/res_users.py @@ -701,6 +701,9 @@ class Users(models.Model): default_user_template = self.env.ref('base.default_user', False) if SUPERUSER_ID in self.ids: raise UserError(_('You can not remove the admin user as it is used internally for resources created by Odoo (updates, module installation, ...)')) + user_admin = self.env.ref('base.user_admin', raise_if_not_found=False) + if user_admin and user_admin in self: + raise UserError(_('You cannot delete the admin user because it is utilized in various places (such as security configurations,...). Instead, archive it.')) self.env.registry.clear_cache() if (portal_user_template and portal_user_template in self) or (default_user_template and default_user_template in self): raise UserError(_('Deleting the template users is not allowed. Deleting this profile will compromise critical functionalities.'))