diff --git a/addons/event_sale/static/src/js/event_configurator_widget.js b/addons/event_sale/static/src/js/event_configurator_widget.js index ea7a5899389..5bbdb3e7033 100644 --- a/addons/event_sale/static/src/js/event_configurator_widget.js +++ b/addons/event_sale/static/src/js/event_configurator_widget.js @@ -113,7 +113,7 @@ ProductConfiguratorWidget.include({ this.do_action('event_sale.event_configurator_action', { additional_context: data, on_close: function (result) { - if (result && result !== 'special') { + if (result && !result.special) { self.trigger_up('field_changed', { dataPointID: dataPointId, changes: result.eventConfiguration, diff --git a/addons/mail/static/tests/activity_tests.js b/addons/mail/static/tests/activity_tests.js index 8134e6699f5..6c3c297ba5a 100644 --- a/addons/mail/static/tests/activity_tests.js +++ b/addons/mail/static/tests/activity_tests.js @@ -457,5 +457,64 @@ QUnit.test('activity view: search more to schedule an activity for a record of a activity.destroy(); }); +QUnit.test('Activity view: discard an activity creation dialog', async function (assert) { + assert.expect(2); + + var actionManager = await createActionManager({ + actions: [{ + id: 1, + name: 'Task Action', + res_model: 'task', + type: 'ir.actions.act_window', + views: [[false, 'activity']], + }], + archs: { + 'task,false,activity': ` + + +
+ +
+
+
`, + 'task,false,search': '', + 'mail.activity,false,form': ` +
+ + + ` + }, + data: this.data, + intercepts: { + do_action(ev) { + actionManager.doAction(ev.data.action, ev.data.options); + } + }, + async mockRPC(route, args) { + if (args.method === 'check_access_rights') { + return true; + } + return this._super(...arguments); + }, + }); + await actionManager.doAction(1); + + await testUtils.dom.click(actionManager.$('.o_activity_view .o_data_row .o_activity_empty_cell')[0]); + assert.containsOnce( + $, + '.modal.o_technical_modal.show', + "Activity Modal should be opened"); + + await testUtils.dom.click($('.modal.o_technical_modal.show button[special="cancel"]')); + assert.containsNone( + $, + '.modal.o_technical_modal.show', + "Activity Modal should be closed"); + + actionManager.destroy(); +}); + }); }); diff --git a/addons/sale_product_configurator/static/src/js/product_configurator_widget.js b/addons/sale_product_configurator/static/src/js/product_configurator_widget.js index e10cc7c8898..cf3c4730e26 100644 --- a/addons/sale_product_configurator/static/src/js/product_configurator_widget.js +++ b/addons/sale_product_configurator/static/src/js/product_configurator_widget.js @@ -149,7 +149,7 @@ ProductConfiguratorWidget.include({ this.do_action('sale_product_configurator.sale_product_configurator_action', { additional_context: data, on_close: function (result) { - if (result && result !== 'special') { + if (result && !result.special) { self._addProducts(result, dataPointId); } else { // is this restoreProductTemplateId ability useful ??? diff --git a/addons/stock/static/src/js/inventory_validate_button_controller.js b/addons/stock/static/src/js/inventory_validate_button_controller.js index ac5367b8d25..3e6899ae0c7 100644 --- a/addons/stock/static/src/js/inventory_validate_button_controller.js +++ b/addons/stock/static/src/js/inventory_validate_button_controller.js @@ -64,7 +64,7 @@ var InventoryValidationController = ListController.extend({ var exitCallback = function (infos) { // In case we discarded a wizard, we do nothing to stay on // the same view... - if (infos === 'special') { + if (infos && infos.special) { return; } // ... but in any other cases, we go back on the inventory form. diff --git a/addons/web/static/src/js/chrome/action_manager_act_window.js b/addons/web/static/src/js/chrome/action_manager_act_window.js index 6027e21bb42..8034a8e54b8 100644 --- a/addons/web/static/src/js/chrome/action_manager_act_window.js +++ b/addons/web/static/src/js/chrome/action_manager_act_window.js @@ -616,7 +616,10 @@ ActionManager.include({ // determine the action to execute according to the actionData if (actionData.special) { - def = Promise.resolve({type: 'ir.actions.act_window_close', infos: 'special'}); + def = Promise.resolve({ + type: 'ir.actions.act_window_close', + infos: { special: true }, + }); } else if (actionData.type === 'object') { // call a Python Object method, which may return an action to execute var args = recordID ? [[recordID]] : [env.resIDs];