The current solution returns two node, one for the css itself, another for the script managing the error. This means that we must know if we have a css error when generating the assets links, when rendering a t-call-assets. The proposed solution will solve this issue by managing the error in the css file itself. A slight change will also save the error in the attachment instead of choosing the previous one, meaning that the error will be saved and the bundle won't be recomputed anymore. This solution also removes the only case when a t-call-assets can return content instead of a link, this will be cleaned in the next commit. As a slight change, a warning will alway be displayed on the bottom of the page, to manage the case where the javascript managing the error is not in the page. Part-of: odoo/odoo#131353
63 lines
1.8 KiB
JavaScript
63 lines
1.8 KiB
JavaScript
/** @odoo-module **/
|
|
|
|
import { makeEnv, startServices } from "./env";
|
|
import { localization } from "@web/core/l10n/localization";
|
|
import { session } from "@web/session";
|
|
import { templates } from "@web/core/assets";
|
|
import { hasTouch } from "@web/core/browser/feature_detection";
|
|
import { _t } from "@web/core/l10n/translation";
|
|
import { App, Component, whenReady } from "@odoo/owl";
|
|
|
|
/**
|
|
* Function to start a webclient.
|
|
* It is used both in community and enterprise in main.js.
|
|
* It's meant to be webclient flexible so we can have a subclass of
|
|
* webclient in enterprise with added features.
|
|
*
|
|
* @param {Component} Webclient
|
|
*/
|
|
export async function startWebClient(Webclient) {
|
|
odoo.info = {
|
|
db: session.db,
|
|
server_version: session.server_version,
|
|
server_version_info: session.server_version_info,
|
|
isEnterprise: session.server_version_info.slice(-1)[0] === "e",
|
|
};
|
|
odoo.isReady = false;
|
|
|
|
// setup environment
|
|
await whenReady();
|
|
const env = makeEnv();
|
|
await startServices(env);
|
|
|
|
Component.env = env;
|
|
|
|
// start web client
|
|
const app = new App(Webclient, {
|
|
name: "Odoo Web Client",
|
|
env,
|
|
templates,
|
|
dev: env.debug,
|
|
warnIfNoStaticProps: true,
|
|
translatableAttributes: ["data-tooltip"],
|
|
translateFn: _t,
|
|
});
|
|
const root = await app.mount(document.body);
|
|
const classList = document.body.classList;
|
|
if (localization.direction === "rtl") {
|
|
classList.add("o_rtl");
|
|
}
|
|
if (env.services.user.userId === 1) {
|
|
classList.add("o_is_superuser");
|
|
}
|
|
if (env.debug) {
|
|
classList.add("o_debug");
|
|
}
|
|
if (hasTouch()) {
|
|
classList.add("o_touch_device");
|
|
}
|
|
// delete odoo.debug; // FIXME: some legacy code rely on this
|
|
odoo.__WOWL_DEBUG__ = { root };
|
|
odoo.isReady = true;
|
|
}
|