[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
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
});
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
});
|
||||
@@ -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"/>
|
||||
|
||||
@@ -27,7 +27,7 @@ odoo.define('web.test.constraint', function (require) {
|
||||
trigger: 'button.o_form_button_save',
|
||||
}, { // check popup content
|
||||
content: "check notification box",
|
||||
trigger: '.o_notification_content:contains(The color code must be positive !)',
|
||||
trigger: '.o_dialog_warning pre:contains(The color code must be positive !)',
|
||||
run: function () {}, // it's a check
|
||||
}]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user