mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Filter by 'in stock' items when auto-allocating to build
This commit is contained in:
parent
4fd7b24e3c
commit
5727e27ae6
@ -189,7 +189,11 @@ class Build(MPTTModel):
|
|||||||
# How many parts required for this build?
|
# How many parts required for this build?
|
||||||
q_required = item.quantity * self.quantity
|
q_required = item.quantity * self.quantity
|
||||||
|
|
||||||
stock = StockItem.objects.filter(part=item.sub_part)
|
# Grab a list of StockItem objects which are "in stock"
|
||||||
|
stock = StockItem.objects.filter(StockItem.IN_STOCK_FILTER)
|
||||||
|
|
||||||
|
# Filter by part reference
|
||||||
|
stock = stock.filter(part=item.sub_part)
|
||||||
|
|
||||||
# Ensure that the available stock items are in the correct location
|
# Ensure that the available stock items are in the correct location
|
||||||
if self.take_from is not None:
|
if self.take_from is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user