Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
132 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Jawaban Terbai

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
Buang
Penulis

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)

Post Terkait Replies Tampilan Aktivitas
0
Agu 25
134
2
Agu 25
333
0
Agu 25
355
1
Agu 25
816
1
Agu 25
570