mirror of
https://github.com/bringout/oca-ocb-report.git
synced 2026-04-18 22:02:03 +02:00
Initial commit: Report packages
This commit is contained in:
commit
bc5e1e9efa
604 changed files with 474102 additions and 0 deletions
|
|
@ -0,0 +1,44 @@
|
|||
/** @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.evalContext.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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue