diff --git a/addons/web/static/src/core/model_field_selector/model_field_selector.js b/addons/web/static/src/core/model_field_selector/model_field_selector.js index bf666287058..08154c48cf5 100644 --- a/addons/web/static/src/core/model_field_selector/model_field_selector.js +++ b/addons/web/static/src/core/model_field_selector/model_field_selector.js @@ -57,9 +57,11 @@ export class ModelFieldSelector extends Component { this.popover.open(currentTarget, { resModel: this.props.resModel, path: this.props.path, - update: (path) => { + update: (path, debug = false) => { this.newPath = path; - this.updateState({ ...this.props, path }, true); + if (!debug) { + this.updateState({ ...this.props, path }, true); + } }, showSearchInput: this.props.showSearchInput, isDebugMode: this.props.isDebugMode, diff --git a/addons/web/static/src/core/model_field_selector/model_field_selector_popover.xml b/addons/web/static/src/core/model_field_selector/model_field_selector_popover.xml index 447d7e58692..2e4a9c79017 100644 --- a/addons/web/static/src/core/model_field_selector/model_field_selector_popover.xml +++ b/addons/web/static/src/core/model_field_selector/model_field_selector_popover.xml @@ -52,7 +52,7 @@ diff --git a/addons/web/static/tests/core/model_field_selector_tests.js b/addons/web/static/tests/core/model_field_selector_tests.js index 1c6a4e5c105..84179ccf0b0 100644 --- a/addons/web/static/tests/core/model_field_selector_tests.js +++ b/addons/web/static/tests/core/model_field_selector_tests.js @@ -963,4 +963,42 @@ QUnit.module("Components", (hooks) => { assert.containsNone(target, ".o_model_field_selector .fa.fa-times"); assert.verifySteps([`path is ""`]); }); + + QUnit.test("Modify path in popover debug input and click away", async (assert) => { + class Parent extends Component { + setup() { + this.path = "foo"; + } + onUpdate(path) { + this.path = path; + assert.step(path); + this.render(); + } + } + Parent.components = { ModelFieldSelector }; + Parent.template = xml` + + `; + + await mountComponent(Parent); + assert.deepEqual(getModelFieldSelectorValues(target), ["Foo"]); + + await openModelFieldSelectorPopover(target); + const input = target.querySelector( + ".o_model_field_selector_popover .o_model_field_selector_debug" + ); + input.value = "foooooo"; + await triggerEvent(input, null, "input"); + assert.deepEqual(getModelFieldSelectorValues(target), ["Foo"]); + + await click(target); + assert.deepEqual(getModelFieldSelectorValues(target), ["foooooo"]); + assert.verifySteps(["foooooo"]); + }); });