Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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
name LIKE %category_values['name']%
Is this even possible here?
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.
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
|Asked: 4/10/13, 7:22 AM|
|Seen: 6673 times|
|Last updated: 3/16/15, 8:10 AM|