diff --git a/addons/web/static/src/webclient/actions/action_service.js b/addons/web/static/src/webclient/actions/action_service.js index a48fe3d3721..32d3749fb2c 100644 --- a/addons/web/static/src/webclient/actions/action_service.js +++ b/addons/web/static/src/webclient/actions/action_service.js @@ -399,11 +399,15 @@ function makeActionManager(env) { return viewSwitcherEntry; }); const context = action.context || {}; + let groupBy = context.group_by || []; + if (typeof groupBy === "string") { + groupBy = [groupBy]; + } const viewProps = Object.assign({}, props, { context, display: { mode: target === "new" ? "inDialog" : target }, domain: action.domain || [], - groupBy: action.context.group_by || [], + groupBy, loadActionMenus: target !== "new" && target !== "inline", loadIrFilters: action.views.some((v) => v[1] === "search"), resModel: action.res_model, diff --git a/addons/web/static/tests/webclient/actions/window_action_tests.js b/addons/web/static/tests/webclient/actions/window_action_tests.js index e367bcf152c..727b7abe3af 100644 --- a/addons/web/static/tests/webclient/actions/window_action_tests.js +++ b/addons/web/static/tests/webclient/actions/window_action_tests.js @@ -2430,4 +2430,20 @@ QUnit.module("ActionManager", (hooks) => { const titleService = webClient.env.services.title; assert.strictEqual(titleService.current, '{"zopenerp":"Odoo","action":"Partners"}'); }); + + QUnit.test("action group_by of type string", async function (assert) { + assert.expect(2); + serverData.views["partner,false,pivot"] = ``; + registry.category("services").add("user", makeFakeUserService()); + const webClient = await createWebClient({ serverData }); + await doAction(webClient, { + name: "Partner", + res_model: "partner", + type: "ir.actions.act_window", + views: [[3, "pivot"]], + context: { group_by: "foo" }, + }); + assert.containsOnce(webClient, ".o_pivot_view"); + assert.containsN(webClient, ".o_pivot_view tbody th", 6); + }); });