Odoo Help

2

How to use logical OR operator with XML-RPC ?

By
Yann Papouin
on 7/24/13, 7:16 AM 5,315 views

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

Acespritech

--Acespritech--
837
| 3 2 6
Gandhinagar, India
--Acespritech--

Having 8+ years of OpenERP Experience. We are Specialized in OpenERP/CRM Solutions, software development, Web development, E commerce solutions & other open source solutions.


Skype : acespritech

Email : info@acespritech.com

Acespritech
On 9/27/13, 5:27 AM

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

0
martin mueller
On 9/26/13, 9:53 PM

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 7/24/13, 7:16 AM
Seen: 5315 times
Last updated: 3/16/15, 8:10 AM