From 546bd945fc822c671fdf70ca2f651cdd2bf45122 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 3 Nov 2024 13:04:55 +1100 Subject: [PATCH] Logic fix for build output creation (#8417) --- src/backend/InvenTree/build/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/InvenTree/build/models.py b/src/backend/InvenTree/build/models.py index 633705f5f8..f5530f074d 100644 --- a/src/backend/InvenTree/build/models.py +++ b/src/backend/InvenTree/build/models.py @@ -853,8 +853,13 @@ class Build( if location is None: location = self.destination or self.part.get_default_location() + if self.part.has_trackable_parts and not serials: + raise ValidationError({ + 'serials': _("Serial numbers must be provided for trackable parts") + }) + # We are generating multiple serialized outputs - if serials or self.part.has_trackable_parts: + if serials: """Create multiple build outputs with a single quantity of 1.""" # Create tracking entries for each item