2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

More tab updates

- Add Stock tab
- Add Stock table for supplier part
- Allow stock API to be filtered by supplier-part ID
- Add Orders tab
This commit is contained in:
Oliver Walters
2020-02-12 11:09:37 +11:00
parent d9d21395d9
commit 8dd8505a2c
7 changed files with 68 additions and 9 deletions

View File

@ -301,6 +301,7 @@ class StockList(generics.ListCreateAPIView):
'part__category',
'part__category__name',
'part__category__description',
'supplier_part',
)
# Reduce the number of lookups we need to do for categories
@ -371,7 +372,13 @@ class StockList(generics.ListCreateAPIView):
except PartCategory.DoesNotExist:
pass
# Filter by supplier
# Filter by supplier_part ID
supplier_part_id = self.request.query_params.get('supplier_part', None)
if supplier_part_id:
stock_list = stock_list.filter(supplier_part=supplier_part_id)
# Filter by supplier ID
supplier_id = self.request.query_params.get('supplier', None)
if supplier_id: