mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-05 14:58:50 +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',
|
'title',
|
||||||
'part',
|
'part',
|
||||||
'quantity',
|
'quantity',
|
||||||
|
'take_from',
|
||||||
'batch',
|
'batch',
|
||||||
'URL',
|
'URL',
|
||||||
'notes',
|
'notes',
|
||||||
|
@ -146,6 +146,11 @@ class Build(models.Model):
|
|||||||
|
|
||||||
stock = StockItem.objects.filter(part=item.sub_part)
|
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!
|
# Only one StockItem to choose from? Default to that one!
|
||||||
if len(stock) == 1:
|
if len(stock) == 1:
|
||||||
stock_item = stock[0]
|
stock_item = stock[0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user