From c5bb52f33eff12b1dcddd2b1c116ef04a772ef96 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 6 Jun 2019 13:35:58 +0000 Subject: [PATCH] [FIX] test_translation_import: avoid selection clash export.selection.withdefault and export.selection both have a selection field with Foo and Bar as possible selections. When doing self.env["base.update.translations"].create({'lang': 'fr_FR'}).act_update() the base.update.translations wizard exports the translations of ALL modules, including the ones of the test_impex module. The generate po entry is something like: #. modules: test_impex, test_translation_import #: selection:export.selection,value:0 #: selection:export.selection.withdefault,value:0 #: selection:test.translation.import,import_type:0 msgid "Bar" msgstr "Bar in french" but may also be #. modules: test_translation_import, test_impex #: selection:export.selection,value:0 #: selection:export.selection.withdefault,value:0 #: selection:test.translation.import,import_type:0 msgid "Bar" msgstr "Bar in french" (not sure where the indeterminism comes from) which creates 3 translation entries that are sometimes linked to the module test_impex (ignored when exporting the translations of test_translation_import) but are sometimes linked to the module test_translation_import instead In the second case, this makes 3 more translations that is was supposed to exist. This commit hides the symptom by making sure there is no longer a clash when exporting the translations of the module test_translation_import. A real fix to avoid creating unnecessary translations during an execution of the base.update.translations wizard must also be made in the future. It is assumed the unnecessary translations problem was already present before a7621137cb0d75ec545152d5e1d413c9d3548e45 but polib introduced the indeterminism making the test fails from time to time. closes odoo/odoo#33958 Signed-off-by: Martin Trigaux (mat) --- odoo/addons/test_translation_import/i18n/fr.po | 4 ++-- .../test_translation_import/i18n/test_translation_import.pot | 4 ++-- odoo/addons/test_translation_import/models.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/odoo/addons/test_translation_import/i18n/fr.po b/odoo/addons/test_translation_import/i18n/fr.po index 25056bc043b..829bdf3af4a 100644 --- a/odoo/addons/test_translation_import/i18n/fr.po +++ b/odoo/addons/test_translation_import/i18n/fr.po @@ -25,7 +25,7 @@ msgstr "1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB in fren #. module: test_translation_import #: selection:test.translation.import,import_type:0 -msgid "Bar" +msgid "Bar Import Type" msgstr "Bar in french" # Note: the line in pot is 21 and is 14 here @@ -37,7 +37,7 @@ msgstr "Ijkl in french" #. module: test_translation_import #: selection:test.translation.import,import_type:0 -msgid "Foo" +msgid "Foo Import Type" msgstr "Foo in french" #. module: test_translation_import diff --git a/odoo/addons/test_translation_import/i18n/test_translation_import.pot b/odoo/addons/test_translation_import/i18n/test_translation_import.pot index d9e87023131..8485bcf7bbe 100644 --- a/odoo/addons/test_translation_import/i18n/test_translation_import.pot +++ b/odoo/addons/test_translation_import/i18n/test_translation_import.pot @@ -37,7 +37,7 @@ msgstr "" #. module: test_translation_import #: selection:test.translation.import,import_type:0 -msgid "Bar" +msgid "Bar Import Type" msgstr "" #. module: test_translation_import @@ -62,7 +62,7 @@ msgstr "" #. module: test_translation_import #: selection:test.translation.import,import_type:0 -msgid "Foo" +msgid "Foo Import Type" msgstr "" #. module: test_translation_import diff --git a/odoo/addons/test_translation_import/models.py b/odoo/addons/test_translation_import/models.py index 35c3c33d5dc..9f5bd31b547 100644 --- a/odoo/addons/test_translation_import/models.py +++ b/odoo/addons/test_translation_import/models.py @@ -11,8 +11,8 @@ class m(models.TransientModel): size=32, help='Efgh') other_name = fields.Char('Test translation with two code type and model') import_type = fields.Selection([ - ('foo', 'Foo'), - ('bar', 'Bar'), + ('foo', 'Foo Import Type'), + ('bar', 'Bar Import Type'), ]) _('Ijkl')