From 46f80759eb1bb3483588abb299ab3b100af3d3a7 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Tue, 25 Oct 2022 12:32:38 +0000 Subject: [PATCH] [FIX] base: settings access test Probably since recent changes in the views architecture, and because the test coverage was recently extended, this test failed when l10n_mx_edit module was installed. While verifying the current user has access to all the fields specified in the settings view, we browse all the fields, including the ones in a sub-view: x_ids being a settings field, but not whatever, which made the test fail. To fix this problem, we check the fields belong to the res.config.settings model before trying to access it. closes odoo/odoo#104119 X-original-commit: 60f22b71063eada039f59321722e794c653acbde Signed-off-by: Victor Feyens (vfe) --- odoo/addons/base/tests/test_res_config.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/odoo/addons/base/tests/test_res_config.py b/odoo/addons/base/tests/test_res_config.py index fd006d3d9cb..925a01b42e5 100644 --- a/odoo/addons/base/tests/test_res_config.py +++ b/odoo/addons/base/tests/test_res_config.py @@ -168,7 +168,12 @@ class TestResConfigExecute(TransactionCase): settings_view_arch = etree.fromstring(settings.get_view(view_id=self.settings_view.id)['arch']) seen_fields = set() for node in settings_view_arch.iterdescendants(tag='field'): - seen_fields.add(node.get('name')) + fname = node.get('name') + if fname not in settings._fields: + # fname isn't a settings fields, but the field of a model + # linked to settings through a relational field + continue + seen_fields.add(fname) models_to_check = defaultdict(set) for field_name in seen_fields: