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) --- .../website/static/src/js/content/website_root_instance.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'addons/website/static/src/js/content/website_root_instance.js') diff --git a/addons/website/static/src/js/content/website_root_instance.js b/addons/website/static/src/js/content/website_root_instance.js index 657ed16784c..fbbefb03651 100644 --- a/addons/website/static/src/js/content/website_root_instance.js +++ b/addons/website/static/src/js/content/website_root_instance.js @@ -1,9 +1,22 @@ odoo.define('root.widget', function (require) { 'use strict'; +const AbstractService = require('web.AbstractService'); +const env = require('web.public_env'); var lazyloader = require('web.public.lazyloader'); var websiteRootData = require('website.root'); +/** + * Configure Owl with the public env + */ +owl.config.mode = env.isDebug() ? "dev" : "prod"; +owl.Component.env = env; + +/** + * Deploy services in the env + */ +AbstractService.prototype.deployServices(env); + var websiteRoot = new websiteRootData.WebsiteRoot(null); return lazyloader.allScriptsLoaded.then(function () { return websiteRoot.attachTo(document.body).then(function () { -- cgit v1.2.3