[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
This commit is contained in:
parent
954fb6da3c
commit
fbdac9c853
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue