summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2019-07-25 11:42:56 +0000
committerfja-odoo <fja@odoo.com>2019-07-30 16:01:20 +0000
commit5ac167a85bde69460f8729bd4af3b249d05849fd (patch)
treef74408784d850406104033e178d97cf9456628e9 /addons
parent09681e566013433157fd96818ed7b767a14ef758 (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')
-rw-r--r--addons/web/static/src/js/public/public_crash_manager.js33
-rw-r--r--addons/web/static/src/js/services/crash_manager.js30
-rw-r--r--addons/web/static/src/js/services/crash_manager_service.js9
-rw-r--r--addons/web/views/webclient_templates.xml2
4 files changed, 66 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);
+
+});
diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml
index 7a96a2c30d7..2c9000ec0ff 100644
--- a/addons/web/views/webclient_templates.xml
+++ b/addons/web/views/webclient_templates.xml
@@ -251,6 +251,7 @@
<script type="text/javascript" src="/web/static/src/js/core/context.js"></script>
<script type="text/javascript" src="/web/static/src/js/core/data_comparison_utils.js"></script>
<script type="text/javascript" src="/web/static/src/js/core/misc.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/services/crash_manager_service.js"></script>
<script type="text/javascript" src="/web/static/src/js/services/data_manager.js"></script>
<script type="text/javascript" src="/web/static/src/js/services/report_service.js"></script>
<script type="text/javascript" src="/web/static/src/js/services/session.js"></script>
@@ -386,6 +387,7 @@
<t t-call="web._assets_frontend_minimal_js"/>
<script type="text/javascript" src="/web/static/src/js/services/session.js"/>
+ <script type="text/javascript" src="/web/static/src/js/public/public_crash_manager.js"/>
<script type="text/javascript" src="/web/static/src/js/public/public_notification.js"/>
<script type="text/javascript" src="/web/static/src/js/public/public_root.js"/>
<script type="text/javascript" src="/web/static/src/js/public/public_root_instance.js"/>