From f6eb23f896bdfd7d251fc66c201be618364fdd8e Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Thu, 1 Jun 2023 13:16:24 +0200 Subject: [PATCH] [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. --- runbot/controllers/frontend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runbot/controllers/frontend.py b/runbot/controllers/frontend.py index e24d1c49..8d8cafee 100644 --- a/runbot/controllers/frontend.py +++ b/runbot/controllers/frontend.py @@ -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: