[FIX] fields: selection, do not try to translate label if label is empty
authorDenis Ledoux <dle@odoo.com>
Wed, 22 Oct 2014 09:41:33 +0000 (11:41 +0200)
committerDenis Ledoux <dle@odoo.com>
Wed, 22 Oct 2014 09:54:22 +0000 (11:54 +0200)
 - translate with no source returns first translation for this field, whatever the source
 - performance

openerp/fields.py

index e2a79ad..6081a61 100644 (file)
@@ -1261,7 +1261,7 @@ class Selection(Field):
             name = "%s,%s" % (self.model_name, self.name)
             translate = partial(
                 env['ir.translation']._get_source, name, 'selection', env.lang)
-            return [(value, translate(label)) for value, label in selection]
+            return [(value, translate(label) if label else label) for value, label in selection]
         else:
             return selection