From 1e6de40b78d1fac70a5aa4b5a73c2e604f8b983a Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 8 Jun 2021 13:25:21 +0000 Subject: [PATCH] [IMP] web: downgrade warning messages to info Two internal warnings are features which literally are not (entirely) implemented, the tests can't be fixed to avoid them. Also augmented the log messages with which test triggered the log, as it's very hard to debug the issue otherwise. As for the qweb debug mode warning, there's no way to disable it easily because multiple tours explicitly opt into debug mode (with good reasons), so it's not enough to just bypass the `mode` setter in the test setup helpers (test_main in POS and main_tests in web), there would also need to be special workarounds in the 4 modules which set `owl.config.mode` based on the session's debug mode. I don't know that this warning is even useful, it defaults to `false` so the only situation in which this would be relevant would be for a third-party to use Owl *and* explicitly enable the debug mode *and* forget to remove it when deploying to production *and* look at their console. --- addons/web/static/lib/owl/owl.js | 6 ++++-- addons/web/static/tests/helpers/mock_server.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/web/static/lib/owl/owl.js b/addons/web/static/lib/owl/owl.js index 29aa09cebb5..fc748477910 100644 --- a/addons/web/static/lib/owl/owl.js +++ b/addons/web/static/lib/owl/owl.js @@ -2818,8 +2818,10 @@ set(mode) { QWeb.dev = mode === "dev"; if (QWeb.dev) { - const url = `https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode`; - console.warn(`Owl is running in 'dev' mode. This is not suitable for production use. See ${url} for more information.`); + console.info(`Owl is running in 'dev' mode. + +This is not suitable for production use. +See https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode for more information.`); } else { console.log(`Owl is now running in 'prod' mode.`); diff --git a/addons/web/static/tests/helpers/mock_server.js b/addons/web/static/tests/helpers/mock_server.js index 34058a7955f..f677b3e7298 100644 --- a/addons/web/static/tests/helpers/mock_server.js +++ b/addons/web/static/tests/helpers/mock_server.js @@ -242,7 +242,7 @@ export class MockServer { // TODO // const pyevalContext = window.py.dict.fromJSON(context || {}); // var v = pyUtils.py_eval(mod, {context: pyevalContext}) ? true : false; - console.warn("MockServer: naive parse of modifier value"); + console.info("MockServer: naive parse of modifier value in", QUnit.config.current.testName); const v = JSON.parse(mod); if (inTreeView && !inListHeader && attr === "invisible") { modifiers.column_invisible = v; @@ -808,7 +808,7 @@ export class MockServer { res[groupByField] = val; } if (field.type === "date" && val) { - console.warn("Mock Server: read group not fully implemented (moment stuff)"); + console.info("Mock Server: read group not fully implemented (moment stuff) in", QUnit.config.current.testName); // const aggregateFunction = groupByField.split(':')[1]; // let startDate; // let endDate;