[IMP] runbot: improve frontend search

When filtering bundles in the frontend, the user is not able to search
for its final trigram because of the `like`search.

With this commit, if the search contains a `%` symbol, the `=like`
operator is used permitting more accurate searches.
This commit is contained in:
Christophe Monniez 2023-06-01 13:16:24 +02:00 committed by xdo
parent 2421a24f78
commit f6eb23f896

View File

@ -142,7 +142,8 @@ class Runbot(Controller):
for search_elem in search.split("|"):
if search_elem.isnumeric():
pr_numbers.append(int(search_elem))
search_domains.append([('name', 'like', search_elem)])
operator = '=like' if '%' in search_elem else 'like'
search_domains.append([('name', operator, search_elem)])
if pr_numbers:
res = request.env['runbot.branch'].search([('name', 'in', pr_numbers)])
if res: