Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4785 มุมมอง

'm trying to update product name translation using jsonRPC , i tried to watch the post request from chrome's network section i found that the requests arguments are :

params: {args: [[576104], {value: "Nilson Cadre Touran 01 Module Encastré."}], model: "ir.translation", method : "write"}

576104 here is translation record ID but i can't find which ID is mapped to my product.template,name field! there's no reference to product id or something

where is the mapping part done?

PS: i'm on odoo 13 and my goal is to translate products names by coding

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Install the package googletrans and import the packages

from googletrans import Translator

Define  a field to translate the product name:

arabic_translation = fields.Char(string="Arabic")

Under an onchange function of name:

source_language = 'en'
destination_language = 'ar'
text_in = self.name
translator = Translator()
result = translator.translate(text_in, src=source_language, dest=destination_language)
self.arabic_translation = result.text

Hope it helps
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ธ.ค. 24
1401
2
ก.พ. 24
2946
4
พ.ย. 23
3355
1
ส.ค. 22
3697
1
มี.ค. 21
21163