diff --git a/runbot/data/error_link.xml b/runbot/data/error_link.xml
index 3917f0e6..2c4c7d79 100644
--- a/runbot/data/error_link.xml
+++ b/runbot/data/error_link.xml
@@ -19,4 +19,14 @@
records.clean_content()
+
+ Re-assign build errors
+
+
+ ir.actions.server
+ code
+
+ records.assign()
+
+
diff --git a/runbot/models/build_error.py b/runbot/models/build_error.py
index c37b5f03..483f72c6 100644
--- a/runbot/models/build_error.py
+++ b/runbot/models/build_error.py
@@ -59,8 +59,6 @@ class BuildError(models.Model):
@api.model_create_multi
def create(self, vals_list):
cleaners = self.env['runbot.error.regex'].search([('re_type', '=', 'cleaning')])
- teams = None
- repos = None
for vals in vals_list:
content = vals.get('content')
cleaned_content = cleaners.r_sub('%', content)
@@ -68,13 +66,20 @@ class BuildError(models.Model):
'cleaned_content': cleaned_content,
'fingerprint': self._digest(cleaned_content)
})
- if 'team_id' not in vals and 'file_path' in vals:
- teams = teams or self.env['runbot.team'].search(['|', ('path_glob', '!=', False), ('module_ownership_ids', '!=', False)])
- repos = repos or self.env['runbot.repo'].search([])
- team = teams._get_team(vals['file_path'], repos)
+ records = super().create(vals_list)
+ records.assign()
+ return records
+
+ def assign(self):
+ if not any((not record.responsible and not record.team_id and record.file_path) for record in self):
+ return
+ teams = self.env['runbot.team'].search(['|', ('path_glob', '!=', False), ('module_ownership_ids', '!=', False)])
+ repos = self.env['runbot.repo'].search([])
+ for record in self:
+ if not record.responsible and not record.team_id and record.file_path:
+ team = teams._get_team(record.file_path, repos)
if team:
- vals.update({'team_id': team.id})
- return super().create(vals_list)
+ record.team_id = team
def write(self, vals):
if 'active' in vals:
diff --git a/runbot/views/build_error_views.xml b/runbot/views/build_error_views.xml
index 3462158b..f61b0e8c 100644
--- a/runbot/views/build_error_views.xml
+++ b/runbot/views/build_error_views.xml
@@ -117,6 +117,7 @@
+