https://github.com/odoo/o-spreadsheet/commit/ab6f47f9 [FIX] InternalViewport: compute the actual visible rect of a zone https://github.com/odoo/o-spreadsheet/commit/966c311e [REF] plugins: unify position getters API https://github.com/odoo/o-spreadsheet/commit/9f1c9695 [IMP] model: ignore type property in command payload https://github.com/odoo/o-spreadsheet/commit/862dacbc [REF] selection: rename getPosition to getActivePosition https://github.com/odoo/o-spreadsheet/commit/0144515a [REF] selection: getPosition return main position https://github.com/odoo/o-spreadsheet/commit/38422f4f [FIX] find and replace: scroll on single match. https://github.com/odoo/o-spreadsheet/commit/9be582c7 [FIX] selection_input: traceback when using unbounded ranges https://github.com/odoo/o-spreadsheet/commit/49285322 [IMP] doc: add tables of contents https://github.com/odoo/o-spreadsheet/commit/2c5d86af [IMP] model: config to provide external dependencies https://github.com/odoo/o-spreadsheet/commit/5b442218 [REF] plugins: use object in constructor https://github.com/odoo/o-spreadsheet/commit/ef98be1b [REM] plugins: remove useless modes https://github.com/odoo/o-spreadsheet/commit/4f20d05f [IMP] data: reorganize data top menu closes odoo/odoo#106583 Related: odoo/enterprise#34412 Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
/** @odoo-module */
|
|
|
|
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
|
|
import { registerCleanup } from "@web/../tests/helpers/cleanup";
|
|
import { getFixture } from "@web/../tests/helpers/utils";
|
|
import { loadJS, templates } from "@web/core/assets";
|
|
|
|
const { App } = owl;
|
|
const { Spreadsheet } = spreadsheet;
|
|
const { getMenuChildren } = spreadsheet.helpers;
|
|
|
|
/** @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.external.env,
|
|
test: true,
|
|
});
|
|
registerCleanup(() => app.destroy());
|
|
const fixture = getFixture();
|
|
await app.mount(fixture);
|
|
return fixture;
|
|
}
|
|
|
|
export async function doMenuAction(registry, path, env) {
|
|
const root = path[0];
|
|
let node = registry.get(root);
|
|
for (const p of path.slice(1)) {
|
|
const children = getMenuChildren(node, env);
|
|
node = children.find((child) => child.id === p);
|
|
}
|
|
if (!node) {
|
|
throw new Error(`Cannot find menu with path "${path.join("/")}"`);
|
|
}
|
|
await node.action(env);
|
|
}
|