Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
18560 Widoki

I read following document about expressing a search domain (args) for xml-rpc:

https://doc.openerp.com/trunk/server/api_models/

Where it's explained how to write the following query:

(name is 'ABC' AND (language is NOT english) AND (country is Belgium OR Germany))

To get:

[('name','=','ABC'),'!',('language.code','=','en_US'),'|',('country_id.code','=','be'),('country_id.code','=','de'))

The arity of the '&' and '|' operator is 2, so how can I wrote the following query:

(name is 'ABC' AND (language is NOT english) AND (country is Belgium OR Germany OR France OR Italy))
Awatar
Odrzuć
Najlepsza odpowiedź

Hi Yann,

Try with this. You can write following in XML-RPC

(name is 'ABC' AND (language is NOT english) AND (country is Belgium OR Germany OR France OR Italy))

as

['|','|','|',('country_id.code','=','be'),('country_id.code','=','ge'),('country_id.code','=','fr'),('country_id.code','=','it'),('name','=','ABC'),('language.code','!=','en_US'),]

Country code maybe different you can replace country code with correct one in above sentense.

Thanks,
www.acespritech.com

Awatar
Odrzuć

Perfect explanation.

Najlepsza odpowiedź

You can query like this:

args = [('name','=','ABC'),'!',('lang','=','en_US'), '|', '|',('country_id.code','=','be'),('country_id.code','=','de'), ('country_id.code', '=', 'fr')]

The line above shows only 3 OR, but 4 would be similar.

This:

args = [('name','=','ABC'),'!',('lang','=','en_US'), '|', '|',('country_id.code','=','be'),('country_id.code','=','de'), '!',  ('country_id.code', '=', 'fr')]

would mean:

(name is 'ABC' AND (language is NOT english) AND (country is Belgium OR Germany OR NOT France))

(even if that does not really make sense!)

Awatar
Odrzuć