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

Merge remote-tracking branch 'inventree/master' into drf-api-forms

This commit is contained in:
Oliver
2021-07-03 12:35:40 +10:00
21 changed files with 6565 additions and 5674 deletions

View File

@ -857,6 +857,17 @@ class StockList(generics.ListCreateAPIView):
print("After error:", str(updated_after))
pass
# Filter stock items which have a purchase price set
has_purchase_price = params.get('has_purchase_price', None)
if has_purchase_price is not None:
has_purchase_price = str2bool(has_purchase_price)
if has_purchase_price:
queryset = queryset.exclude(purchase_price=None)
else:
queryset = queryset.filter(purchase_price=None)
# Optionally, limit the maximum number of returned results
max_results = params.get('max_results', None)