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

In the form of the "product" module, I need to add the fields for translations of this name into other languages, in my case into German, English, and Ukrainian, below the name field.

I tried to do this using

t-esc="product.with_context({'lang': 'de_DE'}).name"

but it didn't help me at all


this is the code in which the name field is located

label class="oe_edit_only" for="name" string="Product Name"
h1>name="name" placeholder="Product Name"/>



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

Yeah, you could do it by creating several computed fields to be able to handle the name translations per lang. One field per lang and implement the compute​ and inverse​ methods of the field to retrieve and save the translation values directly into the ir_translation​ table

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

It's easier than that. 

Just install all the languages you want to use in Odoo. 

Close to the product name will appear the code of the current language. By clicking on it, you will see all translations and you can change them.


Ảnh đại diện
Huỷ bỏ
Tác giả

I know it, but the customer wants to see these fields under the name, not in a separate widget(

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

Hi,

You can add a new field(s) and show translated values in it. Make the new field as a computed field, which computes the translated value from the saved translation.

While doing the compute you can pass the lang in context.

Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Hi, can you show me an example of how to do this?
Thank you

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 8 21
2090
1
thg 7 19
3400
0
thg 7 24
1711
0
thg 11 21
1400
0
thg 7 21
2037