[IMP] web,*: remove legacy env
This commit removes all the legacy envs (common_env, env, public_env) as well as the files used to set up them. task 3439226 closes odoo/odoo#138348 Related: odoo/enterprise#48781 Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
This commit is contained in:
@@ -100,7 +100,6 @@
|
||||
'web/static/src/legacy/js/core/time.js',
|
||||
'web/static/src/legacy/js/core/widget.js',
|
||||
'web/static/src/legacy/js/services/core.js',
|
||||
'web/static/src/legacy/js/common_env.js',
|
||||
|
||||
('include', 'web._assets_bootstrap'),
|
||||
|
||||
@@ -142,13 +141,10 @@
|
||||
|
||||
'web/static/src/legacy/legacy_promise_error_handler.js',
|
||||
'web/static/src/legacy/legacy_rpc_error_handler.js',
|
||||
'web/static/src/legacy/legacy_setup.js',
|
||||
'web/static/src/legacy/utils.js',
|
||||
'web/static/src/legacy/js/env.js',
|
||||
|
||||
'mrp_subcontracting/static/src/subcontracting_portal/*',
|
||||
'web/static/src/start.js',
|
||||
'web/static/src/legacy/legacy_setup.js',
|
||||
],
|
||||
},
|
||||
'uninstall_hook': 'uninstall_hook',
|
||||
|
||||
@@ -186,7 +186,6 @@
|
||||
'web/static/lib/qunit/qunit-2.9.1.js',
|
||||
'web/static/tests/legacy/helpers/**/*',
|
||||
('remove', 'web/static/tests/legacy/helpers/test_utils_tests.js'),
|
||||
'web/static/tests/legacy/legacy_setup.js',
|
||||
|
||||
'web/static/lib/fullcalendar/core/main.css',
|
||||
'web/static/lib/fullcalendar/daygrid/main.css',
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { AbstractAwaitablePopup } from "@point_of_sale/app/popup/abstract_awaitable_popup";
|
||||
import makeTestEnvironment from "@web/../tests/legacy/helpers/test_env";
|
||||
import { click, getFixture, mount, nextTick, triggerEvent } from "@web/../tests/helpers/utils";
|
||||
import { clearRegistryWithCleanup, makeTestEnv } from "@web/../tests/helpers/mock_env";
|
||||
import { registry } from "@web/core/registry";
|
||||
@@ -52,16 +51,12 @@ QUnit.module("unit tests for PopupContainer", {
|
||||
return obj;
|
||||
},
|
||||
});
|
||||
const legacyEnv = makeTestEnvironment();
|
||||
registry.category("services").add("popup", popupService);
|
||||
registry.category("services").add("pos_notification", makeService({ add() {} }));
|
||||
registry.category("services").add("sound", makeService({ play() {} }));
|
||||
registry.category("services").add("pos", makeService({ legacyEnv }));
|
||||
registry.category("services").add("pos", makeService({}));
|
||||
clearRegistryWithCleanup(registry.category("main_components"));
|
||||
env = await makeTestEnv();
|
||||
for (const service of ["pos_notification", "sound", "popup"]) {
|
||||
legacyEnv.services[service] = env.services[service];
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -150,7 +150,6 @@
|
||||
'web/static/src/legacy/js/core/time.js',
|
||||
'web/static/src/legacy/js/core/widget.js',
|
||||
'web/static/src/legacy/js/services/core.js',
|
||||
'web/static/src/legacy/js/common_env.js',
|
||||
('include', 'web._assets_bootstrap_backend'),
|
||||
|
||||
'base/static/src/css/modules.css',
|
||||
@@ -194,9 +193,7 @@
|
||||
|
||||
'web/static/src/legacy/legacy_promise_error_handler.js',
|
||||
'web/static/src/legacy/legacy_rpc_error_handler.js',
|
||||
'web/static/src/legacy/legacy_setup.js',
|
||||
'web/static/src/legacy/utils.js',
|
||||
'web/static/src/legacy/js/env.js',
|
||||
|
||||
'web_editor/static/src/js/editor/odoo-editor/src/base_style.scss',
|
||||
'web_editor/static/lib/vkbeautify/**/*',
|
||||
@@ -226,7 +223,6 @@
|
||||
'project/static/src/project_sharing/search/favorite_menu/custom_favorite_item.xml',
|
||||
'project/static/src/project_sharing/**/*',
|
||||
'web/static/src/start.js',
|
||||
'web/static/src/legacy/legacy_setup.js',
|
||||
],
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
|
||||
@@ -102,7 +102,6 @@ This module provides the core of the Odoo Web Client.
|
||||
'web/static/src/legacy/js/core/time.js',
|
||||
'web/static/src/legacy/js/core/widget.js',
|
||||
'web/static/src/legacy/js/services/core.js',
|
||||
'web/static/src/legacy/js/common_env.js',
|
||||
|
||||
'base/static/src/css/modules.css',
|
||||
|
||||
@@ -135,7 +134,6 @@ This module provides the core of the Odoo Web Client.
|
||||
'web/static/src/legacy/legacy_promise_error_handler.js',
|
||||
'web/static/src/legacy/legacy_rpc_error_handler.js',
|
||||
'web/static/src/legacy/utils.js',
|
||||
'web/static/src/legacy/js/env.js',
|
||||
|
||||
'web/static/src/legacy/xml/base.xml',
|
||||
# Don't include dark mode files in light mode
|
||||
@@ -144,7 +142,6 @@ This module provides the core of the Odoo Web Client.
|
||||
'web.assets_web': [
|
||||
('include', 'web.assets_backend'),
|
||||
'web/static/src/main.js',
|
||||
'web/static/src/legacy/legacy_setup.js',
|
||||
'web/static/src/start.js',
|
||||
],
|
||||
'web.assets_frontend_minimal': [
|
||||
@@ -228,7 +225,6 @@ This module provides the core of the Odoo Web Client.
|
||||
'web/static/src/legacy/js/core/time.js',
|
||||
'web/static/src/legacy/js/core/widget.js',
|
||||
'web/static/src/legacy/js/services/core.js',
|
||||
'web/static/src/legacy/js/common_env.js',
|
||||
|
||||
'web/static/src/env.js',
|
||||
'web/static/src/core/utils/transitions.scss', # included early because used by other files
|
||||
@@ -245,7 +241,6 @@ This module provides the core of the Odoo Web Client.
|
||||
'web/static/src/libs/pdfjs.js',
|
||||
|
||||
'web/static/src/legacy/utils.js',
|
||||
'web/static/src/legacy/js/public/public_env.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',
|
||||
@@ -426,7 +421,6 @@ This module provides the core of the Odoo Web Client.
|
||||
'web/static/lib/qunit/qunit-2.9.1.js',
|
||||
'web/static/tests/legacy/helpers/**/*',
|
||||
('remove', 'web/static/tests/legacy/helpers/test_utils_tests.js'),
|
||||
'web/static/tests/legacy/legacy_setup.js',
|
||||
|
||||
'web/static/lib/fullcalendar/core/main.css',
|
||||
'web/static/lib/fullcalendar/daygrid/main.css',
|
||||
@@ -482,7 +476,6 @@ This module provides the core of the Odoo Web Client.
|
||||
# Legacy
|
||||
'web/static/tests/legacy/**/*.js',
|
||||
('remove', 'web/static/tests/legacy/helpers/**/*.js'),
|
||||
('remove', 'web/static/tests/legacy/legacy_setup.js'),
|
||||
],
|
||||
'web.qunit_mobile_suite_tests': [
|
||||
'web/static/tests/mobile/**/*.js',
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
/**
|
||||
* This file defines the common environment, which contains everything that
|
||||
* is needed in the env for both the backend and the frontend (Odoo
|
||||
* terminology). This module shouldn't be used as is. It should only be
|
||||
* imported by the module defining the final env to use (in the frontend or
|
||||
* in the backend). For instance, module 'web.env' imports it, adds stuff to
|
||||
* it, and exports the final env that is used by the whole webclient
|
||||
* application.
|
||||
*
|
||||
* There should be as much dependencies as possible in the env object. This
|
||||
* will allow an easier testing of components. See [1] for more information
|
||||
* on environments.
|
||||
*
|
||||
* [1] https://github.com/odoo/owl/blob/master/doc/reference/environment.md#content-of-an-environment
|
||||
*/
|
||||
|
||||
import { bus } from "@web/legacy/js/services/core";
|
||||
|
||||
// Build the basic env
|
||||
const env = {
|
||||
bus,
|
||||
debug: odoo.debug,
|
||||
services: {},
|
||||
};
|
||||
|
||||
export default env;
|
||||
@@ -1,9 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
/**
|
||||
* This file defines the env to use in the webclient.
|
||||
*/
|
||||
|
||||
import commonEnv from '@web/legacy/js/common_env';
|
||||
|
||||
export default commonEnv;
|
||||
@@ -1,9 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
/**
|
||||
* This file defines the env to use in the public side.
|
||||
*/
|
||||
|
||||
import commonEnv from "@web/legacy/js/common_env";
|
||||
|
||||
export default commonEnv;
|
||||
@@ -1,14 +1,13 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import dom from '@web/legacy/js/core/dom';
|
||||
import legacyEnv from '@web/legacy/js/public/public_env';
|
||||
import { cookie } from "@web/core/browser/cookie";
|
||||
import publicWidget from '@web/legacy/js/public/public_widget';
|
||||
import { registry } from '@web/core/registry';
|
||||
|
||||
import lazyloader from "@web/legacy/js/public/lazyloader";
|
||||
|
||||
import { mapLegacyEnvToWowlEnv, createWidgetParent } from "../../utils";
|
||||
import { createWidgetParent } from "../../utils";
|
||||
|
||||
import { makeEnv, startServices } from "@web/env";
|
||||
import { loadJS, templates } from '@web/core/assets';
|
||||
@@ -52,9 +51,9 @@ export const PublicRoot = publicWidget.RootWidget.extend({
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
init: function () {
|
||||
init: function (_, env) {
|
||||
this._super.apply(this, arguments);
|
||||
this.env = legacyEnv;
|
||||
this.env = env;
|
||||
this.publicWidgets = [];
|
||||
},
|
||||
/**
|
||||
@@ -304,11 +303,6 @@ export const PublicRoot = publicWidget.RootWidget.extend({
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Configure Owl with the public env
|
||||
*/
|
||||
Component.env = legacyEnv;
|
||||
|
||||
/**
|
||||
* This widget is important, because the tour manager needs a root widget in
|
||||
* order to work. The root widget must be a service provider with the ajax
|
||||
@@ -318,16 +312,15 @@ Component.env = legacyEnv;
|
||||
export async function createPublicRoot(RootWidget) {
|
||||
await lazyloader.allScriptsLoaded;
|
||||
await whenReady();
|
||||
const wowlEnv = makeEnv();
|
||||
|
||||
await startServices(wowlEnv);
|
||||
await wowlEnv.services.public_component.mountComponents();
|
||||
mapLegacyEnvToWowlEnv(legacyEnv, wowlEnv);
|
||||
const publicRoot = new RootWidget(createWidgetParent(legacyEnv));
|
||||
const env = makeEnv();
|
||||
await startServices(env);
|
||||
Component.env = env;
|
||||
await env.services.public_component.mountComponents();
|
||||
const publicRoot = new RootWidget(createWidgetParent(env), env);
|
||||
const app = new App(MainComponentsContainer, {
|
||||
templates,
|
||||
env: wowlEnv,
|
||||
dev: wowlEnv.debug,
|
||||
env,
|
||||
dev: env.debug,
|
||||
translateFn: _t,
|
||||
translatableAttributes: ["data-tooltip"],
|
||||
});
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/** @odoo-module alias=web.legacySetup **/
|
||||
|
||||
import legacyEnv from "@web/legacy/js/env";
|
||||
import { templates } from "@web/core/assets";
|
||||
|
||||
import { Component, whenReady } from "@odoo/owl";
|
||||
|
||||
let legacySetupResolver;
|
||||
export const legacySetupProm = new Promise((resolve) => {
|
||||
legacySetupResolver = resolve;
|
||||
});
|
||||
|
||||
// build the legacy env and set it on Component (this was done in main.js,
|
||||
// with the starting of the webclient)
|
||||
(async () => {
|
||||
Component.env = legacyEnv;
|
||||
await whenReady();
|
||||
legacyEnv.templates = templates;
|
||||
legacySetupResolver(legacyEnv);
|
||||
})();
|
||||
@@ -1,13 +1,11 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import {
|
||||
App,
|
||||
Component,
|
||||
onMounted,
|
||||
onWillStart,
|
||||
onWillUnmount,
|
||||
useComponent,
|
||||
useEnv,
|
||||
useRef,
|
||||
useState,
|
||||
@@ -16,20 +14,6 @@ import {
|
||||
import { templates } from "@web/core/assets";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
|
||||
export const wowlServicesSymbol = Symbol("wowlServices");
|
||||
|
||||
/**
|
||||
* Deploys a service allowing legacy to add/remove commands.
|
||||
*
|
||||
* @param {object} legacyEnv
|
||||
* @returns a wowl deployable service
|
||||
*/
|
||||
export function mapLegacyEnvToWowlEnv(legacyEnv, wowlEnv) {
|
||||
// store wowl services on the legacy env (used by the 'useWowlService' hook)
|
||||
legacyEnv[wowlServicesSymbol] = wowlEnv.services;
|
||||
Object.setPrototypeOf(legacyEnv.services, wowlEnv.services);
|
||||
}
|
||||
|
||||
const reBSTooltip = /^bs-.*$/;
|
||||
|
||||
export function cleanDomFromBootstrap() {
|
||||
@@ -44,20 +28,6 @@ export function cleanDomFromBootstrap() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This hook allows legacy owl Components to use services coming from the wowl env.
|
||||
* @param {string} serviceName
|
||||
* @returns {any}
|
||||
*/
|
||||
export function useWowlService(serviceName) {
|
||||
const component = useComponent();
|
||||
const env = component.env;
|
||||
component.env = { services: env[wowlServicesSymbol] };
|
||||
const service = useService(serviceName);
|
||||
component.env = env;
|
||||
return service;
|
||||
}
|
||||
|
||||
export function createWidgetParent(env) {
|
||||
return {
|
||||
env,
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { makeEnv, startServices } from "./env";
|
||||
import { legacySetupProm } from "./legacy/legacy_setup";
|
||||
import { mapLegacyEnvToWowlEnv } from "./legacy/utils";
|
||||
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, whenReady } from "@odoo/owl";
|
||||
import { App, Component, whenReady } from "@odoo/owl";
|
||||
|
||||
/**
|
||||
* Function to start a webclient.
|
||||
@@ -31,10 +29,10 @@ export async function startWebClient(Webclient) {
|
||||
const env = makeEnv();
|
||||
await startServices(env);
|
||||
|
||||
Component.env = env;
|
||||
|
||||
// start web client
|
||||
await whenReady();
|
||||
const legacyEnv = await legacySetupProm;
|
||||
mapLegacyEnvToWowlEnv(legacyEnv, env);
|
||||
const app = new App(Webclient, {
|
||||
name: "Odoo Web Client",
|
||||
env,
|
||||
|
||||
@@ -4,7 +4,6 @@ import Dialog from "@web/legacy/js/core/dialog";
|
||||
import Widget from "@web/legacy/js/core/widget";
|
||||
import testUtils from "@web/../tests/legacy/helpers/test_utils";
|
||||
import { renderToString } from "@web/core/utils/render";
|
||||
import makeTestEnvironment from "../helpers/test_env";
|
||||
import { SERVICES_METADATA } from "@web/env";
|
||||
import { Component } from "@odoo/owl";
|
||||
|
||||
@@ -405,10 +404,14 @@ QUnit.module('core', {}, function () {
|
||||
|
||||
SERVICES_METADATA.rpc = true;
|
||||
var def;
|
||||
Component.env = await makeTestEnvironment({}, () => {
|
||||
def = testUtils.makeTestPromise();
|
||||
return def;
|
||||
});
|
||||
Component.env = {
|
||||
services: {
|
||||
rpc: () => {
|
||||
def = testUtils.makeTestPromise();
|
||||
return def;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const ChildWidget = Widget.extend({
|
||||
init() {
|
||||
@@ -421,6 +424,7 @@ QUnit.module('core', {}, function () {
|
||||
widget.rpc('/a/route').then(function () {
|
||||
assert.ok(true, "The ajax call should be resolve");
|
||||
});
|
||||
await testUtils.nextMicrotaskTick();
|
||||
def.resolve();
|
||||
await testUtils.nextMicrotaskTick();
|
||||
def = null;
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import Bus from "@web/legacy/js/core/bus";
|
||||
import { templates } from "@web/core/assets";
|
||||
import { App, Component } from "@odoo/owl";
|
||||
|
||||
let app;
|
||||
|
||||
/**
|
||||
* Creates a test environment with the given environment object.
|
||||
* Any access to a key that has not been explicitly defined in the given environment object
|
||||
* will result in an error.
|
||||
*
|
||||
* @param {Object} [env={}]
|
||||
* @param {Function} [providedRPC=null]
|
||||
* @returns {Proxy}
|
||||
*/
|
||||
function makeTestEnvironment(env = {}, providedRPC = null) {
|
||||
if (!app) {
|
||||
app = new App(null, { templates, test: true });
|
||||
}
|
||||
|
||||
function rpc(route, params, options) {
|
||||
if (providedRPC) {
|
||||
return providedRPC(route, params, options);
|
||||
}
|
||||
throw new Error(`No method to perform RPC`);
|
||||
}
|
||||
|
||||
const defaultEnv = {
|
||||
bus: env.bus || new Bus(),
|
||||
debug: env.debug || false,
|
||||
services: {
|
||||
httpRequest(/* route, params = {}, readMethod = 'json' */) {
|
||||
return Promise.resolve('');
|
||||
},
|
||||
hotkey: { add: () => () => {} }, // fake service
|
||||
notification: { notify() {} },
|
||||
rpc,
|
||||
ui: { activeElement: document }, // fake service
|
||||
...env.services,
|
||||
},
|
||||
};
|
||||
return Object.assign(env, defaultEnv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Before each test, we want Component.env to be a fresh test environment.
|
||||
*/
|
||||
QUnit.on('OdooBeforeTestHook', function () {
|
||||
Component.env = makeTestEnvironment();
|
||||
});
|
||||
|
||||
export default makeTestEnvironment;
|
||||
@@ -1,5 +0,0 @@
|
||||
/** @odoo-module alias=web.legacySetup **/
|
||||
|
||||
// in tests, there's nothing to setup globally (we don't want to deploy services),
|
||||
// but this module must exist has it is required by other modules
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { attachComponent, mapLegacyEnvToWowlEnv, useWidget, useWowlService } from "@web/legacy/utils";
|
||||
import { attachComponent, useWidget } from "@web/legacy/utils";
|
||||
|
||||
import makeTestEnvironment from "@web/../tests/legacy/helpers/test_env";
|
||||
import { makeTestEnv } from "@web/../tests/helpers/mock_env";
|
||||
import { getFixture, mount } from "@web/../tests/helpers/utils";
|
||||
import Widget from "@web/legacy/js/core/widget";
|
||||
@@ -124,28 +123,4 @@
|
||||
|
||||
widget.destroy();
|
||||
});
|
||||
|
||||
QUnit.module("useWowlService");
|
||||
|
||||
QUnit.test("simple use case of useWowlService", async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
registry.category("services").add("test", {
|
||||
start() {
|
||||
return "I'm a wowl service";
|
||||
},
|
||||
});
|
||||
const wowlEnv = await makeTestEnv();
|
||||
const legacyEnv = makeTestEnvironment();
|
||||
mapLegacyEnvToWowlEnv(legacyEnv, wowlEnv);
|
||||
|
||||
class MyComponent extends Component {
|
||||
setup() {
|
||||
assert.strictEqual(useWowlService("test"), "I'm a wowl service");
|
||||
}
|
||||
}
|
||||
MyComponent.template = xml`<div/>`;
|
||||
|
||||
await mount(MyComponent, getFixture(), { env: legacyEnv });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,9 +20,6 @@ import {
|
||||
|
||||
import { Component, useSubEnv, xml } from "@odoo/owl";
|
||||
|
||||
import { mapLegacyEnvToWowlEnv } from "@web/legacy/utils";
|
||||
import makeTestEnvironment from "@web/../tests/legacy/helpers/test_env";
|
||||
|
||||
const serviceRegistry = registry.category("services");
|
||||
|
||||
const rootDialogTemplate = xml`<Dialog><View t-props="props.viewProps"/></Dialog>`;
|
||||
@@ -128,22 +125,3 @@ export function setupViewRegistries() {
|
||||
serviceRegistry.add("localization", makeFakeLocalizationService());
|
||||
serviceRegistry.add("company", fakeCompanyService);
|
||||
}
|
||||
|
||||
/**
|
||||
* This helper sets the legacy env and mounts a MainComponentsContainer
|
||||
* to allow legacy code to use wowl FormViewDialogs.
|
||||
*
|
||||
* TODO: remove this when there's no legacy code using the wowl FormViewDialog.
|
||||
*
|
||||
* @param {Object} serverData
|
||||
* @param {Function} [mockRPC]
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export async function prepareWowlFormViewDialogs(serverData, mockRPC) {
|
||||
setupViewRegistries();
|
||||
const wowlEnv = await makeTestEnv({ serverData, mockRPC });
|
||||
const legacyEnv = makeTestEnvironment();
|
||||
mapLegacyEnvToWowlEnv(legacyEnv, wowlEnv);
|
||||
Component.env = legacyEnv;
|
||||
await mount(MainComponentsContainer, getFixture(), { env: wowlEnv });
|
||||
}
|
||||
|
||||
@@ -89,7 +89,6 @@ Odoo Web Editor widget.
|
||||
'web/static/src/legacy/js/core/time.js',
|
||||
'web/static/src/legacy/js/core/widget.js',
|
||||
'web/static/src/legacy/js/services/core.js',
|
||||
'web/static/src/legacy/js/common_env.js',
|
||||
('include', 'web_editor.assets_wysiwyg'),
|
||||
('include', 'web_editor.assets_legacy_wysiwyg'),
|
||||
],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { loadBundle } from "@web/core/assets";
|
||||
import { useWowlService, attachComponent } from '@web/legacy/utils';
|
||||
import { attachComponent } from '@web/legacy/utils';
|
||||
|
||||
export async function loadWysiwygFromTextarea(parent, textarea, options) {
|
||||
var loading = textarea.nextElementSibling;
|
||||
@@ -23,9 +23,6 @@ export async function loadWysiwygFromTextarea(parent, textarea, options) {
|
||||
super(...args);
|
||||
wysiwyg = this;
|
||||
}
|
||||
_useService(serviceName) {
|
||||
return useWowlService(serviceName);
|
||||
}
|
||||
}
|
||||
|
||||
const $wysiwygWrapper = $textarea.closest('.o_wysiwyg_textarea_wrapper');
|
||||
|
||||
@@ -141,11 +141,11 @@ export class Wysiwyg extends Component {
|
||||
});
|
||||
|
||||
setup() {
|
||||
this.orm = this._useService('orm');
|
||||
this.rpc = this._useService('rpc');
|
||||
this.getColorPickerTemplateService = this._useService('get_color_picker_template');
|
||||
this.notification = this._useService("notification");
|
||||
this.popover = this._useService("popover");
|
||||
this.orm = useService('orm');
|
||||
this.rpc = useService('rpc');
|
||||
this.getColorPickerTemplateService = useService('get_color_picker_template');
|
||||
this.notification = useService("notification");
|
||||
this.popover = useService("popover");
|
||||
this.busService = this.env.services.bus_service;
|
||||
|
||||
const getColorPickedHandler = (colorType) => {
|
||||
@@ -3378,9 +3378,6 @@ export class Wysiwyg extends Component {
|
||||
_rpc({ route, params }) {
|
||||
return this._serviceRpc(route, params)
|
||||
}
|
||||
_useService(serviceName) {
|
||||
return useService(serviceName);
|
||||
}
|
||||
}
|
||||
Wysiwyg.activeCollaborationChannelNames = new Set();
|
||||
Wysiwyg.activeWysiwygs = new Set();
|
||||
|
||||
@@ -11,9 +11,6 @@ import { wysiwygData } from "@web_editor/../tests/test_utils";
|
||||
import { OdooEditor } from '@web_editor/js/editor/odoo-editor/src/OdooEditor';
|
||||
import { Wysiwyg } from "@web_editor/js/wysiwyg/wysiwyg";
|
||||
|
||||
// Legacy
|
||||
import legacyEnv from '@web/legacy/js/common_env';
|
||||
|
||||
async function iframeReady(iframe) {
|
||||
const iframeLoadPromise = makeDeferred();
|
||||
iframe.addEventListener("load", function () {
|
||||
@@ -446,15 +443,6 @@ QUnit.module("WebEditor.HtmlField", ({ beforeEach }) => {
|
||||
modifyImageCount += 1;
|
||||
}
|
||||
};
|
||||
// Add the ajax service (legacy), because wysiwyg RPCs use it.
|
||||
patchWithCleanup(legacyEnv, {
|
||||
services: {
|
||||
...legacyEnv.services,
|
||||
ajax: {
|
||||
rpc: mockRPC,
|
||||
},
|
||||
}
|
||||
});
|
||||
await makeView({
|
||||
type: "form",
|
||||
resId: 1,
|
||||
@@ -571,15 +559,6 @@ QUnit.module("WebEditor.HtmlField", ({ beforeEach }) => {
|
||||
return img;
|
||||
}
|
||||
|
||||
// Add the ajax service (legacy), because wysiwyg RPCs use it.
|
||||
patchWithCleanup(legacyEnv, {
|
||||
services: {
|
||||
...legacyEnv.services,
|
||||
ajax: {
|
||||
rpc: mockRPC,
|
||||
},
|
||||
}
|
||||
});
|
||||
await makeView({
|
||||
type: "form",
|
||||
resId: 1,
|
||||
|
||||
@@ -4,7 +4,6 @@ import {CheckBox} from '@web/core/checkbox/checkbox';
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import {useService, useAutofocus} from "@web/core/utils/hooks";
|
||||
import {sprintf} from "@web/core/utils/strings";
|
||||
import {useWowlService} from '@web/legacy/utils';
|
||||
import {WebsiteDialog} from './dialog';
|
||||
import {FormViewDialog} from "@web/views/view_dialogs/form_view_dialog";
|
||||
import { renderToElement } from "@web/core/utils/render";
|
||||
@@ -13,13 +12,7 @@ import { Component, useEffect, useState, xml, useRef } from "@odoo/owl";
|
||||
export class PageDependencies extends Component {
|
||||
setup() {
|
||||
super.setup();
|
||||
try {
|
||||
this.orm = useService('orm');
|
||||
} catch {
|
||||
// We are in a legacy environment.
|
||||
// TODO check with framework team to know if this is really needed.
|
||||
this.orm = useWowlService('orm');
|
||||
}
|
||||
this.orm = useService('orm');
|
||||
|
||||
this.action = useRef('action');
|
||||
this.sprintf = sprintf;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import legacyEnv from '@web/legacy/js/common_env';
|
||||
|
||||
import { useService, useBus } from "@web/core/utils/hooks";
|
||||
import { useHotkey } from '@web/core/hotkeys/hotkey_hook';
|
||||
@@ -12,7 +11,7 @@ import { isMediaElement } from '@web_editor/js/editor/odoo-editor/src/utils/util
|
||||
import { EditMenuDialog, MenuDialog } from "../dialog/edit_menu";
|
||||
import { WebsiteDialog } from '../dialog/dialog';
|
||||
import { PageOption } from "./page_options";
|
||||
import { onWillStart, useEffect, onWillUnmount } from "@odoo/owl";
|
||||
import { Component, onWillStart, useEffect, onWillUnmount } from "@odoo/owl";
|
||||
import { EditHeadBodyDialog } from "../edit_head_body_dialog/edit_head_body_dialog";
|
||||
|
||||
/**
|
||||
@@ -786,7 +785,7 @@ export class WysiwygAdapterComponent extends Wysiwyg {
|
||||
if (evType in triggers) {
|
||||
triggers[evType](ev);
|
||||
} else if (evType === 'call_service') {
|
||||
const service = legacyEnv.services[payload.service];
|
||||
const service = Component.env.services[payload.service];
|
||||
const result = service[payload.method].apply(service, payload.args || []);
|
||||
payload.callback(result);
|
||||
} else {
|
||||
|
||||
@@ -190,7 +190,6 @@ Featuring
|
||||
'web/static/src/legacy/js/core/time.js',
|
||||
'web/static/src/legacy/js/core/widget.js',
|
||||
'web/static/src/legacy/js/services/core.js',
|
||||
'web/static/src/legacy/js/common_env.js',
|
||||
'web/static/src/core/**/*.js',
|
||||
'web/static/src/env.js',
|
||||
'web/static/src/libs/pdfjs.js',
|
||||
|
||||
Reference in New Issue
Block a user