Skip to Content
Menu
This question has been flagged

For some reason I can not get the product-template translation to work.  The python code does send the data to the Odoo server succesfully.  However I can only insert the english text alone...   When inserting the different languages Odoo does not seem to parse the string out.  Any ideas of what I am missing would be greatly appreciated!


model = 'product.template'

method = 'create'


barcode =  '12345678'


en_text = "English Name"

es_text = "Espanola Nombre"

de_text = "Deutscher Name"


name =  { 'en_US' : en_text, 'es_CL' : es_text, 'de_DE' : de_text }


Avatar
Discard
Author Best Answer

Thank you for the reply.


However, this is for a data exchange interface through the api from Arena PLM. To that end I need to have the interface coming from Arena fully populate the product template....


... any other ideas on this?

Avatar
Discard
Author

Thank you for the link....

Here is my solution based on that... ...note: 'name' is the field to be updated. The Id is the actual databaseid of the record to be updated..... ....so this turns out to be a two step solution. Insert a new record and using that recordid (id below) do an update to set the different languages.
operation2.execute_kw(db, internalID2, password, 'product.template', 'update_field_translations', [[id], 'name', {
"en_US": en_text,
"es_CL": es_text,
"de_DE": de_text
}])

Thanks again

Best Answer

Hello Markus,

Try to first "create" the product.

Then use method "write" for each lang. To define the lang use the context (example : context = {'lang': 'es_CL'})

Avatar
Discard
Related Posts Replies Views Activity
3
Feb 23
4383
1
Jan 23
2807
0
Jan 23
1447
1
Feb 24
1099
1
Dec 23
1770