changeset b97cb274358c in trytond:5.0
details: https://hg.tryton.org/trytond?cmd=changeset&node=b97cb274358c
description:
        Convert None selection string to empty string

        This prevents to insert twice the translation when correcting a 
previous None
        string in selection.

        issue10674
        review342961002
diffstat:

 trytond/ir/translation.py |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r a9122914e91d -r b97cb274358c trytond/ir/translation.py
--- a/trytond/ir/translation.py Wed Sep 01 22:46:33 2021 +0200
+++ b/trytond/ir/translation.py Thu Sep 02 23:10:33 2021 +0200
@@ -177,7 +177,7 @@
                     trans_help[trans['name']] = trans
                 elif trans['type'] == 'selection':
                     trans_selection.setdefault(trans['name'], {})
-                    trans_selection[trans['name']][trans['src']] = trans
+                    trans_selection[trans['name']][trans['src']] = trans or ''
 
         def update_insert_field(field, trans_name):
             string_md5 = cls.get_src_md5(field.string)
@@ -219,7 +219,7 @@
         def insert_selection(field, trans_name):
             for (_, val) in field.selection:
                 if (trans_name not in trans_selection
-                        or val not in trans_selection[trans_name]):
+                        or (val or '') not in trans_selection[trans_name]):
                     val_md5 = cls.get_src_md5(val)
                     cursor.execute(*ir_translation.insert(
                             [ir_translation.name, ir_translation.lang,

Reply via email to