Odoo Help

Welcome!

This community 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.

2

xml-rpc search arguments

By
Adrian
on 4/10/13, 7:22 AM 6,023 views

in XML RPC you can search for models with arguments like this:

args = [( "name", "=", category_values['name']),]

but what other operator exists beside =, <=, >= ?

in this instance I'm searching for something that acts like MYSQL's LIKE

name LIKE %category_values['name']%

Is this even possible here?

6

Francesco OpenCode

--Francesco OpenCode--
3608
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 4/10/13, 7:35 AM

Postgres has like and ilike to search with or without case-sensitive application. The other parameters are:

like : [('name', 'like', 'John%')]
ilike : [('name', 'ilike', 'John%')]
= : [('product_id', '=', 122)]
in : [('state', 'in', ('draft', 'done'))]
< : [('price_unit', '<', 14.50)]
<= : >[('price_unit', '<=', 14.50)]
> : [('price_unit', '>', 14.50)]
>= : [('price_unit', '>=', 14.50)]
!= : [('product_id', '!=', 122)]

Also, is interresting to know that OpenERP use Polish Notation to concatenate more search argument. For example if you wanna search a customer with name John you can use:

[('name', 'ilike', 'John%'), ('customer', '=', True)]

Note: the AND operator is implied. If You wanna search a partner called John or Jack you can use this code:

['|', ('name', 'ilike', 'John%'), ('name', 'ilike', 'Jack%')]

where | is the OR operator.

1
Sohail Abbasi
On 8/9/14, 5:53 AM

Can anyone tell how to write this in php with xmlrpc?

0
Zahin
On 8/9/14, 6:56 AM

Regarding XML-RPC Complete solution is here,

http://goo.gl/rZP1Y6

$data = $rpc->searchread( array(array('email','!=','')), "res.partner"); // CORRECT

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 4/10/13, 7:22 AM
Seen: 6023 times
Last updated: 3/16/15, 8:10 AM