[FIX] web: non-deterministic error with translation button on a list view

Since [1], an error was introduced when using the translation button on
a list view. This error occurs in a non-deterministic way. The issue
occurs because without the option stayInEdition when saving the record
before opening the translation dialog, the row is switch to readonly,
and the translation button is not opened.

This occurs in a non-deterministic way because there is a mutex in a
mutex. When switching the modes (in a save with mutex) a second save is
perform (with also a mutex), this commit will also fix this issue.

runbot-issue-id: 22339

1: e2d28e269d

closes odoo/odoo#126942

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2023-06-30 22:07:19 +02:00
parent 699ba2d782
commit 865e1ce376
2 changed files with 2 additions and 2 deletions
@@ -18,7 +18,7 @@ export function useTranslationDialog() {
const addDialog = useOwnedDialogs();
async function openTranslationDialog({ record, fieldName }) {
const saved = await record.save();
const saved = await record.save({ stayInEdition: true });
if (!saved) {
return;
}
@@ -1567,7 +1567,7 @@ class DynamicList extends DataPoint {
} else {
let isSaved;
try {
isSaved = await editedRecord.save();
isSaved = await editedRecord._save();
} catch (e) {
this.editedRecord = editedRecord;
this.model.notify();