[FIX] web_editor: restore m2m create text value before create
Since [1] when the m2m widget was introduced, events that were neither from the create input text nor the create button did remove the internal value of the text that was entered in the create input text. Because of this "Create" had no effect if the user hovered e.g. a suggested blog tag on its way to pointing to the "Create" button. This commit replaces this behaviour by restoring the text value of the create input when the create button is used. [1]: https://github.com/odoo/odoo/commit/be05ac7e2b8d866a72693b761f3bc8576d54e59e task-2811746 X-original-commit: 59ecbb96db75a77cdcce11460cdbe8aa04438449 Part-of: odoo/odoo#109479
This commit is contained in:
@@ -2801,6 +2801,11 @@ const Many2oneUserValueWidget = SelectUserValueWidget.extend({
|
||||
return;
|
||||
}
|
||||
if (widget && widget === this.createButton) {
|
||||
// When the create button is clicked, make sure the text
|
||||
// value is restored from the actual input element because
|
||||
// it might have been removed when hovering existing tags.
|
||||
// TODO review this, there is probably better to do
|
||||
this.createInput._value = this.createInput.el.querySelector('input').value;
|
||||
if (!this.createInput._value) {
|
||||
ev.stopPropagation();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user