From 227be54ff69bb02cf6cacf8ddbc2945dffaa09f1 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 9 Jul 2025 11:37:17 +1000 Subject: [PATCH] Tweak error message (#9985) --- src/backend/InvenTree/build/models.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/backend/InvenTree/build/models.py b/src/backend/InvenTree/build/models.py index 1d510d274b..744a722e14 100644 --- a/src/backend/InvenTree/build/models.py +++ b/src/backend/InvenTree/build/models.py @@ -1180,10 +1180,12 @@ class Build( if prevent_on_incomplete and not output.passedAllRequiredTests( required_tests=required_tests ): - serial = output.serial - raise ValidationError( - _(f'Build output {serial} has not passed all required tests') - ) + msg = _('Build output has not passed all required tests') + + if serial := output.serial: + msg = _(f'Build output {serial} has not passed all required tests') + + raise ValidationError(msg) for build_item in allocated_items: # Complete the allocation of stock for that item