[FIX] web: duplicate translation alert

Before this commit, it is possible to have duplicate field names in an
alert translation.

How:
- enable multi-language
- go to a form view with at least one translatable field
- edit the value of that field
- click on save (the translate alert displays the field name once)
- edit the same field a second time
- click on save

Result Before:
The translate alert displays the field name twice.

Result After:
The translate alert displays the field name once.

closes odoo/odoo#97287

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
FrancoisGe
2022-08-02 10:32:14 +02:00
parent c724126791
commit 96d7fd67e1
2 changed files with 5 additions and 2 deletions
@@ -371,7 +371,9 @@ export class FormController extends Component {
computeTranslateAlert() {
if (this.shouldShowTranslateAlert) {
this.translateAlertData[this.model.root.resId] = new Set([
...(this.translateAlertData[this.model.root.resId] || []),
...(this.translateAlertData[this.model.root.resId]
? toRaw(this.translateAlertData[this.model.root.resId])
: []),
...this.model.root.dirtyTranslatableFields,
]);
}
@@ -7833,7 +7833,8 @@ QUnit.module("Views", (hooks) => {
);
await clickEdit(target);
await editInput(target, '[name="display_name"] input', "test2");
await editInput(target, '[name="foo"] input', "test2");
await editInput(target, '[name="display_name"] input', "test3");
await clickSave(target);
assert.containsN(
target,