[FIX] runbot: make archive work when an error has no linked build

This commit is contained in:
Xavier-Do 2024-12-10 10:38:12 +01:00
parent 7aa68eb3ac
commit 93cd43cd72

View File

@ -178,7 +178,7 @@ class BuildError(models.Model):
if not (self.env.su or self.user_has_groups('runbot.group_runbot_admin')):
if build_error.test_tags:
raise UserError("This error as a test-tag and can only be (de)activated by admin")
if not vals['active'] and build_error.last_seen_date + relativedelta(days=1) > fields.Datetime.now():
if not vals['active'] and build_error.active and build_error.last_seen_date and build_error.last_seen_date + relativedelta(days=1) > fields.Datetime.now():
raise UserError("This error broke less than one day ago can only be deactivated by admin")
return super().write(vals)