Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
5954 Lượt xem

Hi I am trying to connect via XMLRPC to the odoo server. Connection was succesfull and I am able to get the products fields in the "product.template", etc...

I need to get the products names but in a different language. Let say that I have my database in english and I need to get the products name in spanish.

The language of the user I am using to connect to the database is set to Spanish but it gave to me the product names in english.

How can I do that via XMLRPC?

Thanks and regards,

 

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I other forum somebody gave me the answer, this is the way to do that. It is neccessary to pass the language in the context variable:

...execute_kw(db, uid, pwd, 'product.product', 'search_read', [[]], {'fields': ['description', 'name'], 'context' :{'lang': "es_ES"}})

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Amadeo:

The product name field needs to be defined as a Translatable field and the translations of the product names defined in the system for this to work.

In Odoo 13, you can check this by going to Sales > Products > Products and editing one of the existing products. You will see a language code (for example, EN) at the top right inside the field when you are in edit mode. This indicates that the field has been defined as a translatable field. You can access the translations by clicking on the language code (EN in this example).

Ảnh đại diện
Huỷ bỏ

Is there any particular reason why this has been downvoted?

Tác giả

Thanks Paresh for your answer, but it wasn't what I was asking for XMLRPC connection to the Odoo database not an GUI approach. Probably somebody downvoted for this reason I don't know.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 24
2689
1
thg 7 23
2871
0
thg 10 22
3077
0
thg 4 22
3005
0
thg 3 22
2210