summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/chrome/abstract_web_client.js
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2019-06-11 12:26:45 +0000
committerfja-odoo <fja@odoo.com>2019-06-28 08:53:52 +0000
commitf8fe314e786d2100833ecc8b0cb661252f648ddc (patch)
tree0198886f7856f105a0654bfbb95154e0e9804341 /addons/web/static/src/js/chrome/abstract_web_client.js
parente6d4ab84da7a1031ab552b4a6b3fc4aa2348163e (diff)
[IMP] web, *: display warning/error in frontend
* = account, iap, point_of_sale Removing the CrashManager templates from base.xml and moving it to a new file (crash_manager.xml) to allow lazy loading the required xml only when a crash occurs (necessary for the frontend as no xml is pre-loaded). All rpc errors/warnings are now displayed using the same modal system as the backend (crash_manager.js). CrashManager will now return the WarningDialog and ErrorDialog in addition to the CrashManager itself. In some cases an instance of CrashManager was created just to display a warning/error dialog. In the backend all rpc errors but sessionExpired will be logged. If the exception is a warning, NotFound (403) or except_orm, it will be a warning log. The rest will be exception log. In the frontend all rpc errors will be logged using console.debug instead of console.warn and console.error. This way we can trigger rpc errors in tests without failing them. If a real error happend during a test it will fall back on the backend logger to fail the test. Part of https://github.com/odoo/odoo/pull/32132 task-1894820
Diffstat (limited to 'addons/web/static/src/js/chrome/abstract_web_client.js')
-rw-r--r--addons/web/static/src/js/chrome/abstract_web_client.js10
1 files changed, 3 insertions, 7 deletions
diff --git a/addons/web/static/src/js/chrome/abstract_web_client.js b/addons/web/static/src/js/chrome/abstract_web_client.js
index 5adaaa36783..270f2871afe 100644
--- a/addons/web/static/src/js/chrome/abstract_web_client.js
+++ b/addons/web/static/src/js/chrome/abstract_web_client.js
@@ -15,9 +15,8 @@ var ActionManager = require('web.ActionManager');
var concurrency = require('web.concurrency');
var core = require('web.core');
var config = require('web.config');
-var crash_manager = require('web.crash_manager');
+var WarningDialog = require('web.CrashManager').WarningDialog;
var data_manager = require('web.data_manager');
-var Dialog = require('web.Dialog');
var dom = require('web.dom');
var KeyboardNavigationMixin = require('web.KeyboardNavigationMixin');
var Loading = require('web.Loading');
@@ -29,7 +28,6 @@ var utils = require('web.utils');
var Widget = require('web.Widget');
var _t = core._t;
-var qweb = core.qweb;
var AbstractWebClient = Widget.extend(ServiceProviderMixin, KeyboardNavigationMixin, {
dependencies: ['notification'],
@@ -393,11 +391,9 @@ var AbstractWebClient = Widget.extend(ServiceProviderMixin, KeyboardNavigationMi
_onDisplayWarning: function (e) {
var data = e.data;
if (data.type === 'dialog') {
- new Dialog(this, {
- size: 'medium',
+ new WarningDialog(this, {
title: data.title,
- $content: qweb.render("CrashManager.warning", data),
- }).open({shouldFocusButtons: true});
+ }, data).open();
} else {
this.call('notification', 'notify', e.data);
}