diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 9f54713706..504b57cc75 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -32,7 +32,7 @@ class Build(models.Model): URL: External URL for extra information notes: Text notes """ - + def __str__(self): return "Build {q} x {part}".format(q=self.quantity, part=str(self.part)) @@ -137,6 +137,12 @@ class Build(models.Model): if len(stock) == 1: stock_item = stock[0] + # Check that we have not already allocated this stock-item against this build + build_items = BuildItem.objects.filter(build=self, stock_item=stock_item) + + if len(build_items) > 0: + continue + # Are there any parts available? if stock_item.quantity > 0: # Only take as many as are available