https://github.com/odoo/o-spreadsheet/commit/6824b8a1 [REL] 16.3.0-alpha.4 https://github.com/odoo/o-spreadsheet/commit/9b911f61 [FIX] tests: fix indeterministic ui sheet https://github.com/odoo/o-spreadsheet/commit/f20b7be5 [FIX] demo: Align font family with Odoo Task: 3269724 https://github.com/odoo/o-spreadsheet/commit/49a5ee0e [FIX] ColorPicker: Fix checkmark symbol Task: 3269724 https://github.com/odoo/o-spreadsheet/commit/4f2ecfec [REM] menu: remove icons on menu items https://github.com/odoo/o-spreadsheet/commit/54fca81f [REF] *: rename 'menuItem' files to 'action' files https://github.com/odoo/o-spreadsheet/commit/5c23e084 [REF] *: Change names of type 'MenuItem' to 'Action' https://github.com/odoo/o-spreadsheet/commit/e5007fd1 [REF] replace xml tool bar in the xml top bar by menu item buttons https://github.com/odoo/o-spreadsheet/commit/950abc45 [REF] menu registry: factorize menu registries by menu items https://github.com/odoo/o-spreadsheet/commit/c02a7e96 [IMP] topbar menu: add icons for conditional menu items https://github.com/odoo/o-spreadsheet/commit/a19d9cac [IMP] topbar menu: add icons for static menu items https://github.com/odoo/o-spreadsheet/commit/7825124c [IMP] menu: replace right text icon by left icon https://github.com/odoo/o-spreadsheet/commit/be3c3d6f [FIX] viewport: infinite loop with hidden headers https://github.com/odoo/o-spreadsheet/commit/c05be1de [FIX] github: update release-action to latest version https://github.com/odoo/o-spreadsheet/commit/9fdbdab2 [FIX] sheetview: correctly auto-size spreadsheet https://github.com/odoo/o-spreadsheet/commit/7d18b589 [IMP] bottom_bar: hide add sheet button in readonly mode https://github.com/odoo/o-spreadsheet/commit/108b89bd [FIX] menus: don't open submenu is not readonly https://github.com/odoo/o-spreadsheet/commit/1edbc157 [FIX] top bar: remove useless "Save" menu item closes odoo/odoo#118624 Related: odoo/enterprise#39801 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com> Co-authored-by: Alexis Lacroix <laa@odoo.com>
51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
/** @odoo-module */
|
|
|
|
import { Spreadsheet } from "@odoo/o-spreadsheet";
|
|
import { registerCleanup } from "@web/../tests/helpers/cleanup";
|
|
import { getFixture } from "@web/../tests/helpers/utils";
|
|
import { loadJS, templates } from "@web/core/assets";
|
|
|
|
import { App } from "@odoo/owl";
|
|
|
|
/** @typedef {import("@spreadsheet/o_spreadsheet/o_spreadsheet").Model} Model */
|
|
|
|
/**
|
|
* Mount o-spreadsheet component with the given spreadsheet model
|
|
* @param {Model} model
|
|
* @returns {Promise<HTMLElement>}
|
|
*/
|
|
export async function mountSpreadsheet(model) {
|
|
await loadJS("/web/static/lib/Chart/Chart.js");
|
|
const app = new App(Spreadsheet, {
|
|
props: { model },
|
|
templates: templates,
|
|
env: model.config.custom.env,
|
|
test: true,
|
|
});
|
|
registerCleanup(() => app.destroy());
|
|
const fixture = getFixture();
|
|
await app.mount(fixture);
|
|
return fixture;
|
|
}
|
|
|
|
export async function doMenuAction(registry, path, env) {
|
|
await getMenuItem(registry, path, env).execute(env);
|
|
}
|
|
|
|
function getMenuItem(registry, _path, env) {
|
|
const path = [..._path];
|
|
let items = registry.getMenuItems();
|
|
while (items.length && path.length) {
|
|
const id = path.shift();
|
|
const item = items.find((item) => item.id === id);
|
|
if (!item) {
|
|
throw new Error(`Menu item ${id} not found`);
|
|
}
|
|
if (path.length === 0) {
|
|
return item;
|
|
}
|
|
items = item.children(env);
|
|
}
|
|
throw new Error(`Menu item not found`);
|
|
}
|