[IMP] improve search in webshop using a split on white spaces

This commit is contained in:
Nicolas Seinlet 2015-01-07 12:36:38 +01:00 committed by Christophe Matthieu
parent 5e65ee58eb
commit 1eb2507034
1 changed files with 3 additions and 2 deletions

View File

@ -144,8 +144,9 @@ class website_sale(http.Controller):
domain = request.website.sale_product_domain()
if search:
domain += ['|', '|', '|', ('name', 'ilike', search), ('description', 'ilike', search),
('description_sale', 'ilike', search), ('product_variant_ids.default_code', 'ilike', search)]
for srch in search.split(" "):
domain += ['|', '|', '|', ('name', 'ilike', srch), ('description', 'ilike', srch),
('description_sale', 'ilike', srch), ('product_variant_ids.default_code', 'ilike', srch)]
if category:
domain += [('public_categ_ids', 'child_of', int(category))]