Contributors mailing list archives

contributors@odoo-community.org

Avatar

Re: Special way of searching for products

by
Open Source Integrators, Daniel Reis
- 28/04/2021 22:08:48
"Similar to" operator is the % sign.
You can train users to use it, but I don't think this is what they are expecting.

PostgreSQL fuzzy matching might work.
You can try https://odoo-community.org/shop/product/fuzzy-search-698

Or, you can add a stored computed field to use for search, that copies the product code removing special character.
Then use that field as the search target.

/Daniel


On 28/04/2021 22:41, Pierre Verkest wrote:
Few ideas based on postgresql:

* not sure if it's possible with SIMILAR TO or ~ operators
* investigate extension

regards,

Le mer. 28 avr. 2021 à 22:33, Radovan Skolnik <radovan@skolnik.info> a écrit :
Hello,

I have been asked few times by users if it is possible to search for products 
in a way omitting special characters (like dash or space for exmaple) from 
product's default_code (or even input string). Let me give an example:

Let's say we have a product with default_code like CD-12345-XYZ In current 
situation if user enteres "CD12345" or "CD 12345" nothing is retrieved. Vice 
versa, if the default_code is CD12345XYZ and user enters "CD-12345" or "CD 
12345" nothing is retrieved either. So the solution would be to first remove 
those special characters from the string being searched for and then search 
for default_code transformed with some (SQL?) function.

Is anything like that possible? One idea comes to mind using computed field 
where that stripped deault_code would be stored and extending default search 
to use this. However that would require stored computed field. Any way to 
prevent this?

Thank you. Best regards

	Radovan Skolnik


_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe



--
Pierre

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe


--
Daniel Reis
Managing Director
M: +351 919991307
E: DReis@OpenSourceIntegrators.com
Av Doutor Desidério Cambournac 12 • 2710-553 Sintra, Portugal


Reference