Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
18555 Переглядів

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))
Аватар
Відмінити
Найкраща відповідь

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

Аватар
Відмінити

Perfect explanation.

Найкраща відповідь

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!)

Аватар
Відмінити