2

I'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 the 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

Kenly
  • 24,317
  • 7
  • 44
  • 60
Bilel_a
  • 163
  • 1
  • 3
  • 8

1 Answers1

2

You can search field translations of known records (in your example a product template) with 3 known data points: model name, record id and field name.

So as an example how to find translations for product.templates field name for record ID 4711 you can use following search domain:

[('name', '=', 'product.template,name'), ('res_id', '=', 4711)]

That's a straight forward example, but usually you would like to do that programmatically by using those 3 mentioned data points as variables.

Keep the following situations in mind:

  1. You find nothing --> means there is no translation yet, so you have to create one instead of updating a found one
  2. You find more than one translation --> there is no language filter in the above domain filter, so when using more than one language besides English, you get all of the translations
CZoellner
  • 13,553
  • 3
  • 25
  • 38