mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Build.getAutoAllocations() only selects parts from the designation location
This commit is contained in:
parent
468322fa9d
commit
3588161632
@ -21,6 +21,7 @@ class EditBuildForm(HelperForm):
|
||||
'title',
|
||||
'part',
|
||||
'quantity',
|
||||
'take_from',
|
||||
'batch',
|
||||
'URL',
|
||||
'notes',
|
||||
|
@ -146,6 +146,11 @@ class Build(models.Model):
|
||||
|
||||
stock = StockItem.objects.filter(part=item.sub_part)
|
||||
|
||||
# Ensure that the available stock items are in the correct location
|
||||
if self.take_from is not None:
|
||||
# Filter for stock that is located downstream of the designated location
|
||||
stock = stock.filter(location__in=[cat for cat in self.take_from.getUniqueChildren()])
|
||||
|
||||
# Only one StockItem to choose from? Default to that one!
|
||||
if len(stock) == 1:
|
||||
stock_item = stock[0]
|
||||
|
Loading…
Reference in New Issue
Block a user