Skip to Content
Menu
This question has been flagged

Hello,


I am trying to fetch records from the model „product.product“ respectively „product.template“ via the external api (xml-rpc) with language context:


print(models.execute_kw(db, uid, password, 'product.product', 'search_read', [[['id', '=', 19377], ['name', '!=', '']]], {'fields': ['id', 'name'], 'context': {'lang': 'es'}}))


Problem: The api returns product records even when the requested language is not set. 


Example: The product name of the record 19377 (xml_id) has a „de_DE“ (German) language specific value but no „es“ (Spain) specific value. 


What I have tried:

- ['name', '!=', ''] => Returns always a record with the language „de_DE“ 

- ['name', '!=', None] => TypeError: cannot marshal None unless allow_none is enabled

- ['name', '=', True] => []


Question: How can I exclude or filter the records without the requested language? Alternatively, it would also be OK if records are returned but the „name“ is empty.


My goal is to only get product names in the specified language if the language is actually present in the product.


Greetings

Sebastian

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 22
3303
0
Apr 24
1082
2
Aug 24
7706
0
Jul 23
1249
0
Jun 21
4034