From fbdac9c8536675483a103163de0609c216851366 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Thu, 4 Feb 2016 10:52:06 +0100 Subject: [PATCH] [FIX] website: fix search in existing pages Previous implementation did not allow the user to search for pages 'name' but only on the slugified name. Now we slugify the needles before to find a match. 1. Create a new page: 'The new' 2. add a link on your website and try to find this page... - Before this commit, the only ways was to type 'the-new' - After this commit 'the new', 'The new', 'The-new', ... will match This commit closes #10771 --- addons/website/models/website.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 180eee13144..deb9eecce9c 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -432,12 +432,12 @@ class website(osv.osv): def search_pages(self, cr, uid, ids, needle=None, limit=None, context=None): name = (needle or "").replace("/page/website.", "").replace("/page/", "") + name = slugify(name, max_length=50) res = [] for page in self.enumerate_pages(cr, uid, ids, query_string=name, context=context): - if needle in page['loc']: - res.append(page) - if len(res) == limit: - break + res.append(page) + if len(res) == limit: + break return res def kanban(self, cr, uid, ids, model, domain, column, template, step=None, scope=None, orderby=None, context=None):