From e0ef9806a64aebb54642bb9c87c263f91d93a14b Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 17 Jul 2023 15:47:25 +0000 Subject: [PATCH] [FIX] base: invisible groups default on selection group In 9deb1e6aa902a09c4f invisible duplicate were added for boolean groups. But the added test could fail on master when installing only base module: in this case, there is only the group "base.group_allow_export" that is shown as a selection group because it is the only field of its category. When we install other module, the field become a boolean group that is handled by the aboved mentionned commit. The previous fix and test didn't take this case into account, with customization this could be a real issue. With this commit, hidden selection field are also handled and the test test_reified_groups pass in master when installing only base. related to #120310 closes odoo/odoo#128944 X-original-commit: b22fc41d63bded2435cd330517d407abab5035ee Signed-off-by: Nicolas Lempereur (nle) --- odoo/addons/base/models/res_users.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/odoo/addons/base/models/res_users.py b/odoo/addons/base/models/res_users.py index c8e53839e5f..d3f784a9f90 100644 --- a/odoo/addons/base/models/res_users.py +++ b/odoo/addons/base/models/res_users.py @@ -1458,6 +1458,9 @@ class GroupsView(models.Model): xml_by_category[category_name].append(E.newline()) xml_by_category[category_name].append(E.field(name=field_name, **attrs)) xml_by_category[category_name].append(E.newline()) + # add duplicate invisible field so default values are saved on create + if attrs.get('groups') == 'base.group_no_one': + xml0.append(E.field(name=field_name, **dict(attrs, invisible="1", groups='!base.group_no_one'))) else: # application separator with boolean fields