İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
3414 Görünümler
Since odoo 16 the concept of translation has changed,

If I have a new model:



class TestModel(models.Model):
_name = "test.model"

name = fields.Char('Field Name', required=True, translate=True)
And I want to make some entries via the data file:

https://ibb.co/yPbFMc8

The question now is, how insert the translation terms directly through the data file if I have for example English and French?



I tried this format, but it's not rendered to jsonb

https://ibb.co/WxsPpks


Avatar
Vazgeç
En İyi Yanıt

To insert translations for a new model using a data file in Odoo 16, you can use the following format:

Copy code
    noupdate="1">
        
        id="test_model_name_en" model="test.model.name">
            name="lang">en_US
            name="value">Field Name
        

        
        id="test_model_name_fr" model="test.model.name">
            name="lang">fr_FR
            name="value">Nom du champ
        
    

In this example, the element with the id attribute "test_model_name_en" creates a translation record for the English language, and the element with the id attribute "test_model_name_fr" creates a translation record for the French language. The elements within each record specify the language code and the translated value for the field.

You can add as many translation records as you need for different languages and fields. Just make sure to use a unique id attribute for each record and to specify the correct language code and value for each field.

I hope this information is helpful. If you have any further questions or need additional guidance, please don't hesitate to ask.


Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Oca 23
2103
0
Mar 23
2273
1
May 25
2425
1
Nis 25
3441
1
Nis 25
4265