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.

0

How do I control how search terms are combined? How do I "AND" two terms for the same field together (Odoo uses "OR"), like a product with attribute X AND attribute Y?

By
Tom
on 8/15/16, 11:23 PM 253 views

Hello,

I am trying to figure out how to search a product by combining 2 attributes. 

I have a product A which has 2 variant types : brand (brandX and brandY) and color (black, white and blue) : total 6 variants.

I want to be able to search for product A with brandX AND color Black but instead Odoo is searching for product A with brandX OR color black. 

I tried adding +, AND, &, space, brand:brandX, and few other things but it's not working. Any way to achieve this?

Thanks!



0

Ray Carnes

--Ray Carnes--
15677
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 8/16/16, 5:59 PM

Search terms you apply to the same search (usually the same field) are combined with OR.

Example: Enter large, apply to Attributes.  Enter red, apply to Attributes.



Search terms you apply to different searches (usually different fields) are combined with AND.

Example: Enter large, apply to Attributes.  Enter stock, apply to Location.

 

To force Odoo to "OR" your different search terms together:

Use ADD A CONDITION under the Filters Menu beneath the search bar:



This results in two search terms on different fields being applied with OR:



To force Odoo to "AND" your same search terms together

Create two Custom Filters under Filters Menu beneath the search bar.  (Product Attributes is the field to search in your case);

This results in two search terms on the same field being applied with AND:

 

Note: Although the screenshots are from the Enterprise edition of version 9, this is how it works on the Community edition of version 8 and 9.

It works when I use the Custom filter options, thanks.

Tom
on 8/17/16, 5:06 AM
0

Pawan

--Pawan--
1267
| 4 3 5
Hyderabad, India
--Pawan--


Pawan
On 8/16/16, 8:11 AM

Tom,
if i am not wrong with your requirement then you can simply use this domain:

[('<product_field>', '=' product_id),('<brand_field>','=', 'brandX'),('<color_field>','=','black')]

you can use it in your search method and should resolve it!    

Hope it helps!

Thanks but this is complicated to use for my staff... I was looking for something more intuitive.

Tom
on 8/17/16, 5:07 AM

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

1 follower(s)

Stats

Asked: 8/15/16, 11:23 PM
Seen: 253 times
Last updated: 8/16/16, 9:42 PM