diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index af800d4f708..77d52fd61b5 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -3321,6 +3321,16 @@ var FieldDomain = AbstractField.extend({ this._setState(); }, + /** + * We use the on_attach_callback hook here when widget is attached to the DOM, so that + * the inline 'DomainSelector' widget allows field selector to overflow if widget is + * attached within a modal. + */ + on_attach_callback() { + if (this.domainSelector && !this.inDialog) { + this.domainSelector.on_attach_callback(); + } + }, //-------------------------------------------------------------------------- // Public diff --git a/addons/web/static/src/js/widgets/domain_selector.js b/addons/web/static/src/js/widgets/domain_selector.js index 9fe71ce163f..79c22126593 100644 --- a/addons/web/static/src/js/widgets/domain_selector.js +++ b/addons/web/static/src/js/widgets/domain_selector.js @@ -477,6 +477,16 @@ var DomainSelector = DomainTree.extend({ } }); }, + /** + * If 'DomainSelector' is attached within modal, the modal should have + * visible overflow to allow user to see fields drop-down. + */ + on_attach_callback() { + let $modalBodyEl = this.$el.closest('.modal-body'); + if ($modalBodyEl.length !== 0) { + $modalBodyEl.css('overflow', 'visible'); + } + }, //-------------------------------------------------------------------------- // Public diff --git a/addons/web/static/tests/widgets/domain_selector_tests.js b/addons/web/static/tests/widgets/domain_selector_tests.js index a587117f95a..784a7c632f5 100644 --- a/addons/web/static/tests/widgets/domain_selector_tests.js +++ b/addons/web/static/tests/widgets/domain_selector_tests.js @@ -244,6 +244,35 @@ QUnit.module('DomainSelector', { domainSelector.destroy(); }); + + QUnit.test("inline domain editor in modal", async function (assert) { + assert.expect(1); + const actions = [ + { + id: 5, + name: "Partner Form", + res_model: "partner", + target: "new", + type: "ir.actions.act_window", + views: [["view_ref", "form"]], + }, + ]; + const actionManager = await testUtils.createActionManager({ + actions, + archs: { + "partner,view_ref,form": ` +
+ + + `, + }, + data: this.data, + }); + await actionManager.doAction(5); + assert.strictEqual(document.querySelector('div[name="foo"]').closest('.modal-body').style.overflow, + 'visible', "modal should have visible overflow if there is inline domain field widget"); + actionManager.destroy(); + }); }); }); });