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.

1

OE7 - product search functionality change from OR to AND

By
Juha Antila
on 3/27/13, 3:06 PM 1,919 views

Hi,

could somebody please tell how to change the default search functionality to use AND instead of OR when doing a search. For example, if I have some products like this:

t-shirt - red - L

t-shirt - red - XL

t-shirt - black - L

t-shirt - black -XXL

skirt - black - S

and I would like to search for black t-shirts. I would like to enter search terms like: t-shirt, black. With the default behavior, OE7 returns all t-shirts and products with string black in their name.

BR Juha

2

IBS

--IBS--
1302
| 4 5 8
Tétouan, Morocco
--IBS--

For more informations about IBS, please visit our website at www.ibs-na.com.

For a specific questions, collaboration or help, please send us an email to support@ibs-na.com

IBS
On 3/27/13, 6:01 PM

To achieve this:

  • Click the search bar drop down arrow
  • Click Advanced Search
  • Set up a condition on any suitable field.
  • Hit Apply.
  • For your example, you can achieve the desired result by setting up 2 separate filters, the first has a condition on the field Name and its value is t-shirt, the other one has the value black
  • This way you can achieve the AND behavior.

Note: To achieve the OR behavior using this same method, all you have to do is create a filter with several conditions.

To sum it up:

  • Multiple filters with one condition each = AND
  • One filter with several conditions = OR

Hi, thank you for your answer. However this is not what I want to achieve. Using advanced filters is way too slow. My goal is to change the default behaviour to AND because that is the filtering type we need the most. I would also like to do the same when adding products to the sale or purchase order. Because variants are so poorly supported, this would help the variant selection a lot. BR Juha

Small Steps Oy, Juha Antila
on 3/29/13, 3:47 AM

Did anyone found another way to archieve? I am crawling the orm.py and expressions.py already to find a way but I am not successful so far.

Andreas Maertens
on 8/29/13, 11:05 AM
0
Juha Antila
On 6/24/14, 11:22 AM

Hi, there is kind of a way to achieve this functionality by using "%"-sign in searches. It is not perfect in any means but works somehow.

br juha

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

0 follower(s)

Stats

Asked: 3/27/13, 3:06 PM
Seen: 1919 times
Last updated: 3/16/15, 8:10 AM