From a22939532c40031176bc26759253eeed2c1471ec Mon Sep 17 00:00:00 2001 From: Nans Lefebvre <len@odoo.com> Date: Fri, 27 Sep 2019 13:06:06 +0000 Subject: [PATCH] [FIX] base: remove all groups before adding any groups in settings Because of f206714af08 and subsequent commits, adding groups may raise. Thus, it is always safer to first remove groups and then add new groups. The converse could raise, making settings save impossible. Closes #37481 Forward-Port-Of: #37517 --- odoo/addons/base/models/res_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/res_config.py b/odoo/addons/base/models/res_config.py index 948134d9e174..8bd9c61eb1bd 100644 --- a/odoo/addons/base/models/res_config.py +++ b/odoo/addons/base/models/res_config.py @@ -567,7 +567,7 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin) # group fields: modify group / implied groups current_settings = self.default_get(list(self.fields_get())) with self.env.norecompute(): - for name, groups, implied_group in classified['group']: + for name, groups, implied_group in sorted(classified['group'], key=lambda k: self[k[0]]): groups = groups.sudo() implied_group = implied_group.sudo() if self[name] == current_settings[name]: -- GitLab