Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
281 Vues

Hello,


on Odoo 18,

I just inherit res.company and set attribute translate=True like

`street = fields.Char(translate=True)`

There button translation on the field but when I try to set it to my language it always switch back to English.


or any idea to handle this.

Avatar
Ignorer
Meilleure réponse

Hi,


In Odoo 18, simply setting translate=True on fields like street in res.company does not work as expected because these fields are treated as master data, meaning Odoo always displays the stored base value regardless of translations. While you may see the translation button, switching languages will not reflect the translated value. You can work around this in a few ways. One option is to manually manage translations in ir.translation, though this is fragile because updates to the company record can break translations. A better approach is to leverage the linked res.partner record, where you can extend and add translatable fields for the company’s address. Another, less practical option is to create separate companies for each language, but this makes accounting and setup unnecessarily complex. The cleanest long-term solution is to add custom translatable fields (such as street_translated, city_translated) on res.company or res.partner and adapt your reports (invoices, sales orders, purchase orders) to display values based on the document or user’s language. This ensures proper multilingual support for addresses while keeping master data intact.




Hope it helps

Avatar
Ignorer
Meilleure réponse

Hi Theerayut Attajak,


translate=True only makes sense for fields that are stored in ir.translation (like product descriptions, UI labels, etc.). The res.company model is company-specific, not language-specific.


If you need different addresses in different languages, configure multi company. This way, each company can store its own address without using translations.


For more details, please refer to this blog:

https://www.cybrosys.com/blog/how-to-define-translations-in-a-custom-module-add-a-new-language-in-odoo-18

Avatar
Ignorer
Auteur

Thanks @Anagha , but I dont want to use multi company.
So I will create new field to store translated address (actually just want to use this on report)

Publications associées Réponses Vues Activité
2
août 25
240
2
août 25
460
0
août 25
432
1
août 25
949
1
août 25
621