summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/main.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2020-06-08 11:50:24 +0000
committerAaron Bohy <aab@odoo.com>2020-07-13 12:55:07 +0000
commitaf85bb5e13b9c97d022a721bd782a37d718e4496 (patch)
tree731c1983542ec3fc07b3b70832659d5ad803252d /addons/web/static/src/js/main.js
parentce3c7d8714c330b8344ffb76245c364045cbf62f (diff)
[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) <lpe@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/main.js')
-rw-r--r--addons/web/static/src/js/main.js11
1 files changed, 6 insertions, 5 deletions
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;