From db95dcd8bc593f1c232277bf7149c4c5a2baa4a7 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 3 Mar 2016 13:21:29 +0100 Subject: [PATCH] [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 --- openerp/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.