From 865e1ce3766da4b5d7bacbd0e7af3c4fdd29c202 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Fri, 30 Jun 2023 10:41:26 +0000 Subject: [PATCH] [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: e2d28e269d41fb98c98804108e6968349ee26519 closes odoo/odoo#126942 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/views/fields/translation_button.js | 2 +- addons/web/static/src/views/relational_model.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/views/fields/translation_button.js b/addons/web/static/src/views/fields/translation_button.js index 4bd2f7449c9..2214c909782 100644 --- a/addons/web/static/src/views/fields/translation_button.js +++ b/addons/web/static/src/views/fields/translation_button.js @@ -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; } diff --git a/addons/web/static/src/views/relational_model.js b/addons/web/static/src/views/relational_model.js index 31e5ba6886a..0559a5997bf 100644 --- a/addons/web/static/src/views/relational_model.js +++ b/addons/web/static/src/views/relational_model.js @@ -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();