[FIX] web: tags field placeholder when tag selected

This commit properly removes the Many2ManyTagsField and
Many2ManyTagsAvatarField's placeholder when at least one tag has been
selected.

Steps to reproduce:
- In Contacts, open a partner's form view
- Edit and set at least one "tag"
- The placeholder is present next to the selected tags

Note: the placeholder was already present in previous versions.
Reported by FP.

closes odoo/odoo#101042

X-original-commit: 5976e19a31b9b0edaefc1079541514810d12b240
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
This commit is contained in:
Pierre Paridans
2022-09-23 22:04:23 +02:00
parent e0c5834bfb
commit 6c4fb8805e
3 changed files with 9 additions and 2 deletions
@@ -10,7 +10,7 @@
<div t-if="showM2OSelectionField" class="o_field_many2many_selection d-inline-flex w-100" t-on-keydown="onAutoCompleteKeydown" t-ref="autoComplete">
<Many2XAutocomplete
id="props.id"
placeholder="props.placeholder"
placeholder="tags.length ? '' : props.placeholder"
resModel="props.relation"
autoSelect="true"
fieldString="string"
@@ -10,7 +10,7 @@
<div t-if="showM2OSelectionField" class="o_field_many2many_selection d-inline-flex w-100" t-on-keydown="onAutoCompleteKeydown" t-ref="autoComplete">
<Many2XAutocomplete
id="props.id"
placeholder="props.placeholder"
placeholder="tags.length ? '' : props.placeholder"
resModel="props.relation"
autoSelect="true"
fieldString="props.string"
@@ -1585,6 +1585,13 @@ QUnit.module("Fields", (hooks) => {
target.querySelector(".o_field_widget[name='timmy'] input").placeholder,
"Placeholder"
);
await selectDropdownItem(target, "timmy", "gold");
assert.strictEqual(
target.querySelector(".o_field_widget[name='timmy'] input").placeholder,
""
);
});
QUnit.test("Many2ManyTagsField supports 'create' props to be a Boolean", async (assert) => {