[IMP] runbot: allow to search multi terms with |

With this feature you can easily search your branch and branch from your team; or your features...

Eg: jke|-website or -jke|-rde|-qsm|...

Closes: #32
This commit is contained in:
JKE-be 2018-09-06 08:03:57 +00:00 committed by Christophe Monniez
parent 47c3e752e9
commit 0542b68b92

View File

@ -76,7 +76,11 @@ class Runbot(http.Controller):
domain = [('repo_id', '=', repo.id)]
domain += [('state', '!=', key) for key, value in iter(filters.items()) if value == '0']
if search:
domain += ['|', '|', ('dest', 'ilike', search), ('subject', 'ilike', search), ('branch_id.branch_name', 'ilike', search)]
search_domain = []
for to_search in search.split("|"):
search_domain = ['|', '|', '|'] + search_domain
search_domain += [('dest', 'ilike', to_search), ('subject', 'ilike', to_search), ('branch_id.branch_name', 'ilike', to_search)]
domain += search_domain[1:]
build_ids = build_obj.search(domain, limit=int(limit))
branch_ids, build_by_branch_ids = [], {}