From 5aed7d74fbc8503013efc53c7aa3dd47151142b9 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Thu, 5 Dec 2024 08:07:53 +0100 Subject: [PATCH] [FIX] runbot: fix bundle without batch display In some case, when creating a bundle from the backend, it is possible that the bundle has no batch at all, making _get_global_result() fail. --- runbot/models/batch.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runbot/models/batch.py b/runbot/models/batch.py index e617cc0f..63ead5e4 100644 --- a/runbot/models/batch.py +++ b/runbot/models/batch.py @@ -59,6 +59,8 @@ class Batch(models.Model): def _get_global_result(self): """Returns the worst result from the related builds and logs""" + if not self: + return 'ok' self.ensure_one() batch_result = 'warn' if any(log.level != 'INFO' for log in self.log_ids) else 'ok' if self.state == 'skipped':