diff options
| author | fja-odoo <fja@odoo.com> | 2019-07-25 11:42:56 +0000 |
|---|---|---|
| committer | fja-odoo <fja@odoo.com> | 2019-07-30 16:01:20 +0000 |
| commit | 5ac167a85bde69460f8729bd4af3b249d05849fd (patch) | |
| tree | f74408784d850406104033e178d97cf9456628e9 /addons/web/static | |
| parent | 09681e566013433157fd96818ed7b767a14ef758 (diff) | |
[IMP] web: revert warnings display in back-end
Fix for: https://github.com/odoo/odoo/pull/32132
We had changed the display of the warnings in the back-end to be like the
front-end (notification toast). This change needs to be reverted. Now
the warnings in the front-end are toast notifications and in the
back-end they are Warning modals.
Part of: https://github.com/odoo/odoo/pull/35209
Diffstat (limited to 'addons/web/static')
3 files changed, 64 insertions, 8 deletions
diff --git a/addons/web/static/src/js/public/public_crash_manager.js b/addons/web/static/src/js/public/public_crash_manager.js new file mode 100644 index 00000000000..450753e51ad --- /dev/null +++ b/addons/web/static/src/js/public/public_crash_manager.js @@ -0,0 +1,33 @@ +odoo.define('web.PublicCrashManager', function (require) { +"use strict"; + +const core = require('web.core'); +const CrashManager = require('web.CrashManager').CrashManager; + +const PublicCrashManager = CrashManager.extend({ + + //-------------------------------------------------------------------------- + // Private + //-------------------------------------------------------------------------- + + /** + * @override + */ + _displayWarning(message, title, subtitle, options) { + this.displayNotification({ + ...options, + title, + message, + subtitle, + sticky: true, + }); + }, +}); + +core.serviceRegistry.add('crash_manager', PublicCrashManager); + +return { + CrashManager: PublicCrashManager, +}; + +}); diff --git a/addons/web/static/src/js/services/crash_manager.js b/addons/web/static/src/js/services/crash_manager.js index 90c04df7292..6baca444788 100644 --- a/addons/web/static/src/js/services/crash_manager.js +++ b/addons/web/static/src/js/services/crash_manager.js @@ -249,12 +249,7 @@ var CrashManager = AbstractService.extend({ var message = error.data ? error.data.message : error.message; var title = _.str.capitalize(error.type) || _t("Oops Something went wrong !"); var subtitle = error.data ? error.data.title : error.title; - this.displayNotification(_.extend({ - title: title, - message: message, - subtitle: subtitle, - sticky: true, - }, options)); + return this._displayWarning(message, title, subtitle, options); }, show_error: function (error) { if (!active) { @@ -311,6 +306,27 @@ var CrashManager = AbstractService.extend({ data: {debug: ""} }); }, + + //-------------------------------------------------------------------------- + // Private + //-------------------------------------------------------------------------- + + /** + * @private + * @param {string} message + * @param {string} title + * @param {string} subtitle + * @param {Object} options + */ + _displayWarning: function (message, title, subtitle, options) { + return new WarningDialog(this, { + ...options, + title, + subtitle, + }, { + message, + }).open(); + }, }); /** @@ -385,8 +401,6 @@ core.crash_registry.add('504', function (cm) { }; }); -core.serviceRegistry.add('crash_manager', CrashManager); - return { CrashManager: CrashManager, ErrorDialog: ErrorDialog, diff --git a/addons/web/static/src/js/services/crash_manager_service.js b/addons/web/static/src/js/services/crash_manager_service.js new file mode 100644 index 00000000000..44182561a1b --- /dev/null +++ b/addons/web/static/src/js/services/crash_manager_service.js @@ -0,0 +1,9 @@ +odoo.define('crash_manager.service', function (require) { +'use strict'; + +const core = require('web.core'); +const CrashManager = require('web.CrashManager').CrashManager; + +core.serviceRegistry.add('crash_manager', CrashManager); + +}); |
