From 17ca484ed7aca72a8affadcd286e900e93855203 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Fri, 17 Nov 2023 11:15:02 +0100 Subject: [PATCH] [IMP] runbot: allow to search errors in a single version When filtering the build error tree view based on the versions equality, the results may not be what you expect. e.g.: searching for `versions is equal to 16.0` gives the errors that appeared in `16.0` (hopefully) but also those which appeared in other versions too. With this commit, this search will give the errors that appeared in the specified version only. When the user wants to list errors that appeared in `16.0` and other versions too, he has to use the `contains 16.0` criteria. --- runbot/models/build_error.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runbot/models/build_error.py b/runbot/models/build_error.py index a4179caa..842455d4 100644 --- a/runbot/models/build_error.py +++ b/runbot/models/build_error.py @@ -220,7 +220,11 @@ class BuildError(models.Model): return ['-%s' % tag for tag in self._test_tags_list()] def _search_version(self, operator, value): - return [('build_ids.version_id', operator, value)] + exclude_domain = [] + if operator == '=': + exclude_ids = self.env['runbot.build.error'].search([('version_ids', '!=', value)]) + exclude_domain = [('id', 'not in', exclude_ids.ids)] + return [('build_ids.version_id', operator, value)] + exclude_domain def _search_trigger_ids(self, operator, value): return [('build_ids.trigger_id', operator, value)]