From af85bb5e13b9c97d022a721bd782a37d718e4496 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 8 Jun 2020 11:50:24 +0000 Subject: [IMP] web,*: do not deploy services in tests *mail,point_of_sale,web_editor,website In the tests, required services are deployed for each test independently. There is no need to have, in additon, all services deployed globally. Worse, it could conflict and lead to unexpected results. This commit ensures services are no longer deployed globally in tests. It turns the module 'web.env' into a declarative module with no side-effect, by moving the service deployment to main.js, which isn't added to the tests page. Task 2287397 closes odoo/odoo#53817 Signed-off-by: Lucas Perais (lpe) --- addons/web/static/src/js/main.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'addons/web/static/src/js/main.js') diff --git a/addons/web/static/src/js/main.js b/addons/web/static/src/js/main.js index 49b90228ba2..465ea0d63d4 100644 --- a/addons/web/static/src/js/main.js +++ b/addons/web/static/src/js/main.js @@ -1,18 +1,20 @@ odoo.define('web.web_client', function (require) { "use strict"; + const AbstractService = require('web.AbstractService'); const env = require('web.env'); const session = require("web.session"); const WebClient = require('web.WebClient'); + // configure the env and set it on Owl Component owl.config.mode = env.isDebug() ? "dev" : "prod"; owl.Component.env = env; - const webClient = new WebClient(); + // deploy services in the env + AbstractService.prototype.deployServices(env); - /** - * Add the owl templates to the environment and start the web client. - */ + // add the owl templates to the environment and start the web client + const webClient = new WebClient(); async function startWebClient() { await session.is_bound; env.qweb.addTemplates(session.owlTemplates); @@ -21,7 +23,6 @@ odoo.define('web.web_client', function (require) { webClient.setElement($(document.body)); webClient.start(); } - startWebClient(); return webClient; -- cgit v1.2.3