summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ledoux <dle@odoo.com>2016-03-03 13:21:29 +0100
committerDenis Ledoux <dle@odoo.com>2016-03-03 13:21:56 +0100
commitdb95dcd8bc593f1c232277bf7149c4c5a2baa4a7 (patch)
treed41289dea3c43ab748de96447ca3d982b2ddc5aa
parent17e79711e493298ab44c1194395db2a0a86d3b55 (diff)
[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
-rw-r--r--openerp/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/openerp/models.py b/openerp/models.py
index 51b0c51d292..3e350b84d41 100644
--- a/openerp/models.py
+++ b/openerp/models.py
@@ -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.