From 85fd2478788e85256447806097510e61dba26250 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 26 Apr 2022 15:54:03 +1000 Subject: [PATCH] Fix for 'auto-allocate' stock to build orders - Allocation of serialized stock items would cause issue - Exclude serialized stock from auto allocation process --- InvenTree/build/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 9ba348b0b4..e5189e6073 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -871,6 +871,9 @@ class Build(MPTTModel, ReferenceIndexingMixin): part__in=[p for p in available_parts], ) + # Filter out "serialized" stock items, these cannot be auto-allocated + available_stock = available_stock.filter(Q(serial=None) | Q(serial='')) + if location: # Filter only stock items located "below" the specified location sublocations = location.get_descendants(include_self=True)