[IMP] web,*: remove legacy/utils.js from backend

This commit removes useless function from legacy/utils.js and removes it
from several backend bundles. The file is moved in wysiwyg and frontend
bundles as it is still used in these bundles.

task id: 3439226

closes odoo/odoo#140260

Related: odoo/enterprise#49812
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
This commit is contained in:
Michael (mcm)
2023-10-30 15:18:00 +00:00
parent d8c0373f33
commit 89bf62b0c1
8 changed files with 5 additions and 42 deletions
@@ -129,8 +129,6 @@
# Form style should be computed before
'web/static/src/views/form/button_box/*.scss',
'web/static/src/legacy/utils.js',
'mrp_subcontracting/static/src/subcontracting_portal/*',
'web/static/src/start.js',
],
-1
View File
@@ -157,7 +157,6 @@
'web/static/src/legacy/js/**/*',
('remove', 'web/static/src/legacy/js/libs/**/*'),
('remove', 'web/static/src/legacy/js/public/**/*'),
'web/static/src/legacy/utils.js',
'web/static/src/search/**/*',
'web/static/src/views/fields/field_tooltip.js',
'web/static/src/views/fields/field.js',
-2
View File
@@ -178,8 +178,6 @@
# Form style should be computed before
'web/static/src/views/form/button_box/*.scss',
'web/static/src/legacy/utils.js',
'web_editor/static/src/js/editor/odoo-editor/src/base_style.scss',
'web_editor/static/lib/vkbeautify/**/*',
'web_editor/static/src/js/common/**/*',
-3
View File
@@ -116,8 +116,6 @@ This module provides the core of the Odoo Web Client.
# Form style should be computed before
'web/static/src/views/form/button_box/*.scss',
'web/static/src/legacy/utils.js',
'web/static/src/legacy/xml/base.xml',
# Don't include dark mode files in light mode
('remove', 'web/static/src/**/*.dark.scss'),
@@ -218,7 +216,6 @@ This module provides the core of the Odoo Web Client.
'web/static/src/public/datetime_picker_widget.js',
'web/static/src/libs/pdfjs.js',
'web/static/src/legacy/utils.js',
'web/static/src/legacy/js/public/public_root.js',
'web/static/src/legacy/js/public/public_root_instance.js',
'web/static/src/legacy/js/public/public_widget.js',
@@ -7,8 +7,6 @@ import { registry } from '@web/core/registry';
import lazyloader from "@web/legacy/js/public/lazyloader";
import { createWidgetParent } from "../../utils";
import { makeEnv, startServices } from "@web/env";
import { loadJS, templates } from '@web/core/assets';
import { MainComponentsContainer } from "@web/core/main_components_container";
@@ -322,7 +320,7 @@ export async function createPublicRoot(RootWidget) {
await startServices(env);
Component.env = env;
await env.services.public_component.mountComponents();
const publicRoot = new RootWidget(createWidgetParent(env), env);
const publicRoot = new RootWidget(null, env);
const app = new App(MainComponentsContainer, {
templates,
env,
-27
View File
@@ -4,33 +4,6 @@ import { App, Component, useState, xml } from "@odoo/owl";
import { templates } from "@web/core/assets";
import { _t } from "@web/core/l10n/translation";
const reBSTooltip = /^bs-.*$/;
export function cleanDomFromBootstrap() {
const body = document.body;
// multiple bodies in tests
// Bootstrap tooltips
const tooltips = body.querySelectorAll("body .tooltip");
for (const tt of tooltips) {
if (Array.from(tt.classList).find((cls) => reBSTooltip.test(cls))) {
tt.parentNode.removeChild(tt);
}
}
}
export function createWidgetParent(env) {
return {
env,
_trigger_up: (ev) => {
if (ev.name === "call_service") {
const service = env.services[ev.data.service];
const result = service[ev.data.method].apply(service, ev.data.args || []);
ev.data.callback(result);
}
},
};
}
const rootTemplate = xml`<SubComp t-props="state"/>`;
export async function attachComponent(parent, element, componentClass, props = {}) {
class Root extends Component {
@@ -8,7 +8,6 @@ import { evaluateExpr } from "@web/core/py_js/py";
import { registry } from "@web/core/registry";
import { Deferred, KeepLast } from "@web/core/utils/concurrency";
import { useBus, useService } from "@web/core/utils/hooks";
import { cleanDomFromBootstrap } from "@web/legacy/utils";
import { View, ViewNotFoundError } from "@web/views/view";
import { ActionDialog } from "./action_dialog";
import { CallbackRecorder } from "./action_hook";
@@ -678,7 +677,6 @@ function makeActionManager(env) {
if (!this.isMounted) {
reject(error);
}
cleanDomFromBootstrap();
if (this.isMounted) {
// the error occurred on the controller which is
// already in the DOM, so simply show the error
@@ -775,7 +773,6 @@ function makeActionManager(env) {
};
let nextDialog = null;
if (action.target === "new") {
cleanDomFromBootstrap();
const actionDialogProps = {
ActionComponent: ControllerComponent,
actionProps: controller.props,
@@ -796,7 +793,6 @@ function makeActionManager(env) {
if (onClose) {
onClose();
}
cleanDomFromBootstrap();
},
});
nextDialog = {
+4
View File
@@ -104,6 +104,7 @@ Odoo Web Editor widget.
'web/static/src/legacy/js/core/mixins.js',
'web/static/src/legacy/js/core/service_mixins.js',
'web/static/src/legacy/js/core/widget.js',
'web/static/src/legacy/utils.js',
# lib
'web_editor/static/lib/cropperjs/cropper.css',
@@ -203,6 +204,9 @@ Odoo Web Editor widget.
'web_editor/static/src/js/frontend/loader_loading.js',
],
'web.assets_frontend': [
# legacy stuff that are no longer in assets_backend
'web/static/src/legacy/utils.js',
('include', 'web_editor.assets_media_dialog'),
'web_editor/static/src/js/editor/odoo-editor/src/base_style.scss',