Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
18042 Widoki

I would like to search for a product with "desk" and "pad" in the name.

When I enter both words into the search, I get this:


How can I get "and" instead?

Awatar
Odrzuć
Najlepsza odpowiedź

use % between words

Awatar
Odrzuć

This is also a great option. If you have a product called "Bacon Maple Burger" and you enter "bacon%burger" you will return matches to that product, since the % means "anything in between".

Najlepsza odpowiedź

You can make a quick customization to the Search View:

You are essentially adding the name search a SECOND TIME to the view.


You then get this:




With Odoo Studio:

Drag the NAME field to the Search View:



Adjust the XML to relabel the field.


Without Odoo Studio:

Create this Custom View:


<field name="name" position="after">
<field name="name" string='Product "and"'
filter_domain="['|', '|', '|', ('default_code', 'ilike', self),
('product_variant_ids.default_code', 'ilike', self),
('name', 'ilike', self), ('barcode', 'ilike', self)]"/>
</field>
Awatar
Odrzuć

But what if you wanted to do 5 different ANDs? Would you need to add the NAME field to the search menu 5 times?

If I want to search for the "red oak table leg", but I'm not exactly sure how they named it in the system. I may want to search for "red" AND "oak" AND "leg".

Yes, but is this really happening? Your search for "red" or "oak" or "table" or "leg" is returning hundreds of matches?

Najlepsza odpowiedź

Don't modify Odoo's code to do this. Just use the advanced filter twice:


Awatar
Odrzuć

I really think Odoo should change the default to AND and then people can use the Custom Filter for OR searches. At least in our shop, we NEVER need to do an OR search on a product name. It is always an AND search. I'm not sure what company would need a default OR search. It seems like if you type in one Product search parameter and didn't see what you wanted, you could delete that parameter and then search for a different one. If there were too many results on one parameter, then adding a second with an OR operator would return more results, not less. Is there some logic in defaulting to OR? Or is it just how they did it and nobody wants to change it?

Indeed, very strange that the default is OR. As jbarnhart@minespress.com, I'm sure AND would be much more useful.

Using the advanced filter is way too many clicks for something that should be default behaviour. Please change the default from OR to AND.

Powiązane posty Odpowiedzi Widoki Czynność
0
mar 15
5080
0
cze 24
1415
1
gru 22
6281
3
sty 20
7010
1
sty 24
15230