mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improve filtering for stock items
This commit is contained in:
parent
011f5a5efd
commit
e278bdbb90
@ -6,10 +6,9 @@
|
||||
{% csrf_token %}
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
<b>Stock Items</b>
|
||||
<table class='table table-condensed table-striped' id='stock-table'>
|
||||
<tr>
|
||||
<th>Item</th>
|
||||
<th>Stock Item</th>
|
||||
<th>Location</th>
|
||||
<th>{{ stock_action }}</th>
|
||||
<th></th>
|
||||
|
@ -135,15 +135,14 @@ class StockItemMoveMultiple(AjaxView, FormMixin):
|
||||
stock_items = []
|
||||
|
||||
def get_items(self, item_list):
|
||||
""" Return list of stock items. """
|
||||
""" Return list of stock items initally requested using GET """
|
||||
|
||||
items = []
|
||||
# Start with all 'in stock' items
|
||||
items = StockItem.objects.filter(customer=None, belongs_to=None)
|
||||
|
||||
for pk in item_list:
|
||||
try:
|
||||
items.append(StockItem.objects.get(pk=pk))
|
||||
except StockItem.DoesNotExist:
|
||||
pass
|
||||
# Client provides a list of individual stock items
|
||||
if 'stock[]' in self.request.GET:
|
||||
items = items.filter(id__in=self.request.GET.getlist('stock[]'))
|
||||
|
||||
return items
|
||||
|
||||
@ -166,6 +165,8 @@ class StockItemMoveMultiple(AjaxView, FormMixin):
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
||||
self.request = request
|
||||
|
||||
# Save list of items!
|
||||
self.stock_items = self.get_items(request.GET.getlist('stock[]'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user