diff --git a/addons/spreadsheet/static/tests/links/menu_data_utils.js b/addons/spreadsheet/static/tests/links/menu_data_utils.js index 846bd8b8487..acb687e4e12 100644 --- a/addons/spreadsheet/static/tests/links/menu_data_utils.js +++ b/addons/spreadsheet/static/tests/links/menu_data_utils.js @@ -2,20 +2,26 @@ import { getBasicData } from "@spreadsheet/../tests/utils/data"; - export function getMenuServerData() { const serverData = {}; serverData.menus = { - root: { id: "root", children: [1, 2], name: "root", appID: "root" }, + root: { id: "root", children: [1], name: "root", appID: "root" }, 1: { id: 1, + children: [11, 12], + name: "App_1", + appID: 1, + xmlid: "app_1", + }, + 11: { + id: 11, children: [], name: "menu with xmlid", appID: 1, xmlid: "test_menu", actionID: "action1", }, - 2: { id: 2, children: [], name: "menu without xmlid", appID: 2 }, + 12: { id: 12, children: [], name: "menu without xmlid", actionID: "action1", appID: 1 }, }; serverData.actions = { action1: { @@ -39,8 +45,8 @@ export function getMenuServerData() { groups_id: { string: "Groups", type: "many2many", relation: "res.group" }, }, records: [ - { id: 1, name: "menu with xmlid", action: "action1", groups_id: [10] }, - { id: 2, name: "menu without xmlid", action: "action2", groups_id: [10] }, + { id: 11, name: "menu with xmlid", action: "action1", groups_id: [10] }, + { id: 12, name: "menu without xmlid", action: "action1", groups_id: [10] }, ], }, "res.users": { diff --git a/addons/spreadsheet/static/tests/links/model/link_menu_cells_test.js b/addons/spreadsheet/static/tests/links/model/link_menu_cells_test.js index 257233d3353..4133a3d25fc 100644 --- a/addons/spreadsheet/static/tests/links/model/link_menu_cells_test.js +++ b/addons/spreadsheet/static/tests/links/model/link_menu_cells_test.js @@ -41,19 +41,19 @@ QUnit.module("spreadsheet > menu link cells", { beforeEach }, () => { QUnit.test("ir.menu linked based on record id", async function (assert) { const env = await makeTestEnv({ serverData: getMenuServerData() }); const model = new Model({}, { custom: { env } }); - setCellContent(model, "A1", "[label](odoo://ir_menu_id/2)"); + setCellContent(model, "A1", "[label](odoo://ir_menu_id/12)"); const cell = getCell(model, "A1"); const evaluatedCell = getEvaluatedCell(model, "A1"); assert.equal(evaluatedCell.value, "label", "The value should be the menu name"); assert.equal( cell.content, - "[label](odoo://ir_menu_id/2)", + "[label](odoo://ir_menu_id/12)", "The content should be the complete markdown link" ); assert.equal(evaluatedCell.link.label, "label", "The link label should be the menu name"); assert.equal( evaluatedCell.link.url, - "odoo://ir_menu_id/2", + "odoo://ir_menu_id/12", "The link url should reference the correct menu" ); }); @@ -88,19 +88,19 @@ QUnit.module("spreadsheet > menu link cells", { beforeEach }, () => { QUnit.test("Odoo link cells can be imported/exported", async function (assert) { const env = await makeTestEnv({ serverData: getMenuServerData() }); const model = new Model({}, { custom: { env } }); - setCellContent(model, "A1", "[label](odoo://ir_menu_id/2)"); + setCellContent(model, "A1", "[label](odoo://ir_menu_id/12)"); let cell = getCell(model, "A1"); let evaluatedCell = getEvaluatedCell(model, "A1"); assert.equal(evaluatedCell.value, "label", "The value should be the menu name"); assert.equal( cell.content, - "[label](odoo://ir_menu_id/2)", + "[label](odoo://ir_menu_id/12)", "The content should be the complete markdown link" ); assert.equal(evaluatedCell.link.label, "label", "The link label should be the menu name"); assert.equal( evaluatedCell.link.url, - "odoo://ir_menu_id/2", + "odoo://ir_menu_id/12", "The link url should reference the correct menu" ); const model2 = new Model(model.exportData(), { custom: { env } }); @@ -109,13 +109,13 @@ QUnit.module("spreadsheet > menu link cells", { beforeEach }, () => { assert.equal(evaluatedCell.value, "label", "The value should be the menu name"); assert.equal( cell.content, - "[label](odoo://ir_menu_id/2)", + "[label](odoo://ir_menu_id/12)", "The content should be the complete markdown link" ); assert.equal(evaluatedCell.link.label, "label", "The link label should be the menu name"); assert.equal( evaluatedCell.link.url, - "odoo://ir_menu_id/2", + "odoo://ir_menu_id/12", "The link url should reference the correct menu" ); });