2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-09 07:00: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

@ -369,10 +369,10 @@ class StockList(generics.ListCreateAPIView):
if in_stock:
# Filter out parts which are not actually "in stock"
stock_list = stock_list.filter(customer=None, belongs_to=None, build_order=None)
stock_list = stock_list.filter(StockItem.IN_STOCK_FILTER)
else:
# Only show parts which are not in stock
stock_list = stock_list.exclude(customer=None, belongs_to=None, build_order=None)
stock_list = stock_list.exclude(StockItem.IN_STOCK_FILTER)
# Filter by 'allocated' patrs?
allocated = self.request.query_params.get('allocated', None)
@ -511,9 +511,9 @@ class StockList(generics.ListCreateAPIView):
filter_fields = [
'supplier_part',
'customer',
'belongs_to',
'build',
'build_order',
'sales_order',
'build_order',
]