[FIX] models: translate fields label, even for en_US
In Odoo 7.0 & 8.0, this was possible to translate
a field label, from `en_US` to `en_US`. It was
used as an easy way to change the fields label,
instead of creating an inherited view changing
the string attribute of the field everywhere it was needed.
This was no longer the case in 9.0,
following the revision 9593a29.
The translated terms for `en_US` have been
excluded, for performance reasons
as it was considered not possible to have
translated terms for the `en_US` language.
The fact is, this is very possible: Nothing
prevents to add a translated term
in `en_US` for a translate-able field,
as this is the case for the fields label,
as mentioned above. This field is then
used as the display value instead of the source
term when being in the `en_US` language.
Besides, the above revision was mainly to
give the possibility to sort a model records
on a translated field, using a join on the translations
table. It was then considered that the join could
be avoided, in the case where the user language was `en_US`,
for performance reasons, but, as this is possible
to give another value to the field value trough
the translations, it should actually be done, even
for the records sorting.
opw-670814
This commit is contained in:
+1
-1
@@ -4585,7 +4585,7 @@ class BaseModel(object):
|
||||
:return: the qualified field name (or expression) to use for ``field``
|
||||
"""
|
||||
lang = self._context.get('lang')
|
||||
if lang and lang != 'en_US':
|
||||
if lang:
|
||||
# Sub-select to return at most one translation per record.
|
||||
# Even if it shoud probably not be the case,
|
||||
# this is possible to have multiple translations for a same record in the same language.
|
||||
|
||||
Reference in New Issue
Block a user