mirror of
https://github.com/bringout/oca-web.git
synced 2026-04-19 23:11:58 +02:00
Add oca-web submodule with 68 web modules
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
af56672c08
commit
53fddf87c8
2469 changed files with 101716 additions and 0 deletions
|
|
@ -0,0 +1,40 @@
|
|||
/** @odoo-module **/
|
||||
import {registry} from "@web/core/registry";
|
||||
import {Component} from "@odoo/owl";
|
||||
|
||||
export async function findTrip(model, viewType) {
|
||||
const trips = registry.category("trips").getAll();
|
||||
const selectorResults = await Promise.all(
|
||||
trips.map((trip) => trip.selector(model, viewType))
|
||||
);
|
||||
const matchedTrips = trips.filter((trip, i) => selectorResults[i]);
|
||||
if (matchedTrips.length >= 1) {
|
||||
if (matchedTrips.length != 1) {
|
||||
console.warn("More than one trip found", model, viewType);
|
||||
}
|
||||
return matchedTrips[0].Trip;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function wait(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
export async function waitUntilAvailable(selector, ms = 50) {
|
||||
const selection = $(selector);
|
||||
|
||||
if (!selection.length) {
|
||||
await wait(ms);
|
||||
return await waitUntilAvailable(selector, ms);
|
||||
}
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
export async function doAction(xmlId, options = {}) {
|
||||
Component.env.bus.trigger("do-action", {
|
||||
action: xmlId,
|
||||
options: options,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue