Files
odoo_source/addons/spreadsheet/static/tests/links/menu_data_utils.js
T
Rmi Rahir (rar) 7b5f1df3d1 [FIX] spreadsheet: Fix bad serverData in js tests
The menus added in the server data which are used in mockServer did not
reflect a realistic menu configuration. This was brought to light when
trying to fix the addition of links to ir.ui.menu inside a spreadsheet.
See task 2821480

Related ENT pr: https://github.com/odoo/enterprise/pull/42885

closes odoo/odoo#126497

X-original-commit: 128475e8c29f8493b01710342179a5c468897c61
Related: odoo/enterprise#43209
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-06-27 13:44:25 +02:00

69 lines
2.2 KiB
JavaScript

/** @odoo-module */
import { getBasicData } from "@spreadsheet/../tests/utils/data";
export function getMenuServerData() {
const serverData = {};
serverData.menus = {
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",
},
12: { id: 12, children: [], name: "menu without xmlid", actionID: "action1", appID: 1 },
};
serverData.actions = {
action1: {
id: 99,
xml_id: "action1",
name: "action1",
res_model: "ir.ui.menu",
type: "ir.actions.act_window",
views: [[false, "list"]],
},
};
serverData.views = {};
serverData.views["ir.ui.menu,false,list"] = `<tree></tree>`;
serverData.views["ir.ui.menu,false,search"] = `<search></search>`;
serverData.models = {
...getBasicData(),
"ir.ui.menu": {
fields: {
name: { string: "Name", type: "char" },
action: { string: "Action", type: "char" },
groups_id: { string: "Groups", type: "many2many", relation: "res.group" },
},
records: [
{ id: 11, name: "menu with xmlid", action: "action1", groups_id: [10] },
{ id: 12, name: "menu without xmlid", action: "action1", groups_id: [10] },
],
},
"res.users": {
fields: {
name: { string: "Name", type: "char" },
groups_id: { string: "Groups", type: "many2many", relation: "res.group" },
},
records: [
{ id: 1, name: "Raoul", groups_id: [10] },
{ id: 2, name: "Joseph", groups_id: [] },
],
},
"res.group": {
fields: { name: { string: "Name", type: "char" } },
records: [{ id: 10, name: "test group" }],
},
};
return serverData;
}