تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
133 أدوات العرض

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.

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
الكاتب

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)

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أغسطس 25
134
2
أغسطس 25
333
0
أغسطس 25
355
1
أغسطس 25
816
1
أغسطس 25
570