[IMP] web: always reset the autocomplete input for properties tags

Purpose
=======
Always reset the autocomplete value when creating a new tag,
even if the tag already exists.

Technical
=========
The input value is reset when the tag is created because the props
of the autocomplete component change, but if we do not change the props
of the autocomplete component (e.g. because the tag already exist and
nothing should be done), the text value is not reset.

Add a new option for that purpose.

Task-2965523

X-original-commit: 352e811e821ef7c1fc075c32dda7272145749526
Part-of: odoo/odoo#101487
This commit is contained in:
std-odoo
2022-09-28 19:31:53 +02:00
parent 608bffff59
commit 89a9253ccf
2 changed files with 7 additions and 1 deletions
@@ -124,6 +124,10 @@ export class AutoComplete extends Component {
return;
}
if (this.props.resetOnSelect) {
this.inputRef.el.value = "";
}
this.forceValFromProp = true;
this.props.onSelect(option, {
...params,
@@ -295,6 +299,7 @@ Object.assign(AutoComplete, {
},
placeholder: { type: String, optional: true },
autoSelect: { type: Boolean, optional: true },
resetOnSelect: { type: Boolean, optional: true },
onInput: { type: Function, optional: true },
onChange: { type: Function, optional: true },
onBlur: { type: Function, optional: true },
@@ -12,7 +12,8 @@
<AutoComplete
value="''"
sources="autocompleteSources"
onSelect.bind="(event) => this.onOptionSelected(event.value)"/>
onSelect.bind="({value}) => this.onOptionSelected(value)"
resetOnSelect="true"/>
<a role="button" class="o_dropdown_button" draggable="false" />
</div>
</div>