Odoo Help


Search for a name "starting with"...

Antoine Morit
on 6/18/14, 3:54 AM 3,673 views

When you use a search, for example in the partner view, you get all names containing the word searched.

example for a search "te" :

ABC Company Limited, Tested One, View Technologies,  etc...

Is there a way to get only the names starting with the word searched ?

For the same example, for a search "te", we will only get :

Tested One

Thanks for help

Bogus answer. i accidentally clicked on "Convert to answer" on a comment (that wasn't even mine!) and I can't find a way to delete this answer.

MONK Software, Leonardo Donelli
on 6/18/14, 5:01 AM

In search box, click on little down arrow and open full search menu. Select advanced search, choice name beginnig with Antonio Maria Vigliotti

SHS-AV s.r.l.
on 6/18/14, 5:56 AM

Sorry, Leonardo is right. There is no option "beginning with" in advanced search

SHS-AV s.r.l.
on 6/18/14, 5:57 AM

René Schuster

--René Schuster--
| 5 5 8
Weinheim, Germany
--René Schuster--

Challenge Everything!

René Schuster
On 6/18/14, 4:55 AM

Let's stick to your example: res.partner view

The search view has this field:

<field name="name" filter_domain="['|','|',('name','ilike',self),('parent_id','ilike',self),('ref','=',self)]"></field>

Let's focus on the first search tuple: ('name','ilike',self)

That filters all partners, that has the entered search name as part of the their name. (Note that ilike operator is case-insensitive (ilike is postgresql specific), while like is case-sensitive). SQL: name ILIKE '%self%'

What you want to perform is the query: name ILIKE 'self%'.

The like and ilike operators in OpenERP automatically add the wildcards arround the search term. To avoid that, you should use =like and =ilike operators. You then need to add the wildcard manually (otherwise it will search for the exact term), so I would guess you should change the search tuple to:


I'm not sure you can add strings this way, but give it a try. Also change the other search tuples accordingly.


EDIT (since the reactions on this answer are wrongly brisk):

I've tested the mentioned search domain (name,'=ilike',self+'%') and it doesn't work.

What did work was (name,'=ilike',self) and searching for 'te%'. But that's not very userfriendly.

So the derived question from the OPs question is: How to automatically add the wildcard to the search term?


Best regards.


Ivan Elizaryev

--Ivan Elizaryev--
| 4 3 7
Ufa, Russian Federation
--Ivan Elizaryev--

I tried odoo at the end of 2013. I fell in love in it and have been working with odoo as a freelancer for almost two years. In September 2015 I began operate as a Company and have 5 developers for now.

Ivan, March 2016.

Ivan Elizaryev
On 6/19/14, 2:49 AM

I have tested René Schuster's solution on latest version openerp and it works:

<field name="name" filter_domain="['|','|',('name','=ilike',self+'%'),('parent_id','=ilike',self+'%'),('ref','=',self)]"></field>

it sends correct request ang get correct result



It returns only contacts starting with "a".

So, the solution is to modify base.view_res_partner_filter view with filter_domain above


Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 6/18/14, 5:49 AM


You can use '=like' or '=ilike' operator in domain for starting with comparision.

This is since v5, glad to share I worked for expression.py.


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.


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

6 follower(s)


Asked: 6/18/14, 3:54 AM
Seen: 3673 times
Last updated: 3/24/17, 8:07 AM