2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-05 21:20:56 +00:00

More work

- Consolidated "in_stock" filter to single code location
- Improve 'limit_choices_to' for BuildItem and SalesOrderAllocation
- Various template improvements etc
This commit is contained in:
Oliver Walters
2020-04-26 16:38:29 +10:00
parent 4147163418
commit e768ada83b
20 changed files with 362 additions and 79 deletions

View File

@ -258,9 +258,7 @@ class StockExport(AjaxView):
stock_items = stock_items.filter(supplier_part=supplier_part)
# Filter out stock items that are not 'in stock'
# TODO - This might need some more thought in the future...
stock_items = stock_items.filter(customer=None)
stock_items = stock_items.filter(belongs_to=None)
stock_items = stock_items.filter(StockItem.IN_STOCK_FILTER)
# Pre-fetch related fields to reduce DB queries
stock_items = stock_items.prefetch_related('part', 'supplier_part__supplier', 'location', 'purchase_order', 'build')
@ -314,7 +312,7 @@ class StockAdjust(AjaxView, FormMixin):
"""
# Start with all 'in stock' items
items = StockItem.objects.filter(customer=None, belongs_to=None)
items = StockItem.objects.filter(StockItem.IN_STOCK_FILTER)
# Client provides a list of individual stock items
if 'stock[]' in self.request.GET: