diff --git a/addons/web/static/src/js/chrome/abstract_action.js b/addons/web/static/src/js/chrome/abstract_action.js index b300cb22cf4..982b750ab56 100644 --- a/addons/web/static/src/js/chrome/abstract_action.js +++ b/addons/web/static/src/js/chrome/abstract_action.js @@ -130,7 +130,7 @@ var AbstractAction = Widget.extend(ActionMixin, { this._setTitle(this.controlPanelProps.title); } this.controlPanelProps.title = this.getTitle(); - this._controlPanelWrapper = new ComponentWrapper(this, ControlPanel, this.controlPanelProps); + this._controlPanelWrapper = new ComponentWrapper(this, this.config.ControlPanel, this.controlPanelProps); await this._controlPanelWrapper.mount(this.el, { position: 'first-child' }); } diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js index 3a452b20d52..02ba1d2472d 100644 --- a/addons/web/static/tests/chrome/action_manager_tests.js +++ b/addons/web/static/tests/chrome/action_manager_tests.js @@ -19,6 +19,7 @@ var Widget = require('web.Widget'); var createActionManager = testUtils.createActionManager; const cpHelpers = testUtils.controlPanel; +const { xml } = owl.tags; QUnit.module('ActionManager', { beforeEach: function () { @@ -1882,6 +1883,29 @@ QUnit.module('ActionManager', { delete core.action_registry.map.HelloWorldTest; }); + QUnit.test('action can use a custom control panel', async function (assert) { + assert.expect(1); + + class CustomControlPanel extends owl.Component {} + CustomControlPanel.template = xml/* xml */` +
My custom control panel
+ ` + const ClientAction = AbstractAction.extend({ + hasControlPanel: true, + config: { + ControlPanel: CustomControlPanel + }, + }); + const actionManager = await createActionManager(); + core.action_registry.add('HelloWorldTest', ClientAction); + await actionManager.doAction('HelloWorldTest'); + assert.containsOnce(actionManager, '.custom-control-panel', + "should have a custom control panel"); + + actionManager.destroy(); + delete core.action_registry.map.HelloWorldTest; + }); + QUnit.test('breadcrumb is updated on title change', async function (assert) { assert.expect(2);