跳至內容
選單
此問題已被標幟

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
11月 22
4855
0
4月 24
2140
2
8月 24
8982
0
7月 23
2477
0
6月 21
5238