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

Hello,

I'm writing a script to import products and their details on Odoo. 

I can import products and their details correctly, but I want to include their values in two languages (en_US and it_IT). 

Is there a way, via XMLRPC, to add translations while creating records?


What I want would be really similar to this:


self.write('product.attribute.value', attribute_value_id, {
'name': [
['en_US', attribute_value_name + " in English"],
['it_IT', attribute_value_name + " but in Italian"]
]
})

Googled a bit and can't find anything working or relevant. I'm using Odoo 16.

Thanks in advance!.
Ảnh đại diện
Huỷ bỏ
Tác giả

up

Câu trả lời hay nhất

Hi, if someone are still looking how to update translated field here is the right code to use using update_field_translations :

odoo = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(ODOO_URL)
odoo.execute_kw(db, username, password, 'product.template', 'update_field_translations', [[$yourID$], 'description_sale', {
"it_IT": "IT desc",
"en_US": "En desc"
}])



Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 23
12189
0
thg 6 20
61
2
thg 5 25
4518
1
thg 11 22
2624
3
thg 6 22
5754