summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/web/static/src/js/services/crash_manager.js1
-rw-r--r--addons/web/static/tests/chrome/action_manager_tests.js52
-rw-r--r--addons/web/static/tests/helpers/test_utils.js1
3 files changed, 54 insertions, 0 deletions
diff --git a/addons/web/static/src/js/services/crash_manager.js b/addons/web/static/src/js/services/crash_manager.js
index 2ca64dc5275..8430f3700f3 100644
--- a/addons/web/static/src/js/services/crash_manager.js
+++ b/addons/web/static/src/js/services/crash_manager.js
@@ -48,6 +48,7 @@ var CrashManagerDialog = Dialog.extend({
this._super.apply(this, [parent, options]);
this.message = error.message;
this.traceback = error.traceback;
+ core.bus.off('close_dialogs', this);
},
});
diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js
index 3bc111ac1ba..f8dc72c4a93 100644
--- a/addons/web/static/tests/chrome/action_manager_tests.js
+++ b/addons/web/static/tests/chrome/action_manager_tests.js
@@ -15,6 +15,7 @@ var RamStorage = require('web.RamStorage');
var ReportService = require('web.ReportService');
var SessionStorageService = require('web.SessionStorageService');
var testUtils = require('web.test_utils');
+var WarningDialog = require('web.CrashManager').WarningDialog;
var Widget = require('web.Widget');
var createActionManager = testUtils.createActionManager;
@@ -587,6 +588,57 @@ QUnit.module('ActionManager', {
actionManager.destroy();
});
+ QUnit.test('executing a window action with onchange warning does not hide it', async function (assert) {
+ assert.expect(2);
+
+ this.archs['partner,false,form'] = `
+ <form>
+ <field name="foo"/>
+ </form>`;
+
+ var actionManager = await createActionManager({
+ actions: this.actions,
+ archs: this.archs,
+ data: this.data,
+ mockRPC: function (route, args) {
+ if (args.method === 'onchange') {
+ return Promise.resolve({
+ value: {},
+ warning: {
+ title: "Warning",
+ message: "Everything is alright",
+ type: 'dialog',
+ },
+ });
+ }
+ return this._super.apply(this, arguments);
+ },
+ intercepts: {
+ warning: function (event) {
+ new WarningDialog(actionManager, {
+ title: event.data.title,
+ }, event.data).open();
+ },
+ },
+ });
+
+ await actionManager.doAction(3);
+
+ await testUtils.dom.click(actionManager.$('.o_list_button_add'));
+ assert.containsOnce(
+ $,
+ '.modal.o_technical_modal.show',
+ "Warning modal should be opened");
+
+ await testUtils.dom.click($('.modal.o_technical_modal.show button.close'));
+ assert.containsNone(
+ $,
+ '.modal.o_technical_modal.show',
+ "Warning modal should be closed");
+
+ actionManager.destroy();
+ });
+
QUnit.module('Push State');
QUnit.test('properly push state', async function (assert) {
diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js
index e998ab14de8..33aa43279e8 100644
--- a/addons/web/static/tests/helpers/test_utils.js
+++ b/addons/web/static/tests/helpers/test_utils.js
@@ -118,6 +118,7 @@ odoo.define('web.test_utils', async function (require) {
// to load xml files that are normally lazy loaded by specific widgets).
await Promise.all([
session.is_bound,
+ ajax.loadXML('/web/static/src/xml/crash_manager.xml', core.qweb),
ajax.loadXML('/web/static/src/xml/debug.xml', core.qweb),
ajax.loadXML('/web/static/src/xml/dialog.xml', core.qweb),
ajax.loadXML('/web/static/src/xml/translation_dialog.xml', core.qweb),