From f576c96a88f9d483e4b44f25dbd0fe7f9759d92c Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 7 May 2021 11:32:08 +0000 Subject: [PATCH] [FIX] web: route /web/session/modules returns a list Since the changing of assets (8cc066173dfb61bd95b8e1f0716f71f4e251810a) the /web/session/modules route returned a stringified set instead of a list After this commit, the route returns a list closes odoo/odoo#70545 X-original-commit: 54e4a48996826dd8ea16a84517b46a847d6daf3f Signed-off-by: Lucas Perais (lpe) --- addons/web/controllers/main.py | 2 +- addons/web/tests/test_session_info.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index bca3f772b8d..5216379b66a 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1222,7 +1222,7 @@ class Session(http.Controller): @http.route('/web/session/modules', type='json', auth="user") def modules(self): # return all installed modules. Web client is smart enough to not load a module twice - return request.env.registry._init_modules | set([module.current_test] if module.current_test else []) + return list(request.env.registry._init_modules | set([module.current_test] if module.current_test else [])) @http.route('/web/session/save_session_action', type='json', auth="user") def save_session_action(self, the_action): diff --git a/addons/web/tests/test_session_info.py b/addons/web/tests/test_session_info.py index 3db8fe89cf2..0385d593e18 100644 --- a/addons/web/tests/test_session_info.py +++ b/addons/web/tests/test_session_info.py @@ -56,3 +56,9 @@ class TestSessionInfo(common.HttpCase): result['user_companies'], expected_user_companies, "The session_info['user_companies'] does not have the expected structure") + + def test_session_modules(self): + self.authenticate(self.user.login, self.user_password) + response = self.url_open("/web/session/modules", data=self.payload, headers=self.headers) + data = response.json() + self.assertTrue(isinstance(data['result'], list))