Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2735 Visualizzazioni

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
nov 22
4863
0
apr 24
2144
2
ago 24
8991
0
lug 23
2482
0
giu 21
5239