[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.
This commit is contained in:
Christophe Monniez 2023-11-17 11:15:02 +01:00 committed by xdo
parent 08c614a86e
commit 2999f92cdb

View File

@ -222,7 +222,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)]