mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-16 12:05:53 +00:00
Pass list of selected stock items to the view
This commit is contained in:
@ -132,9 +132,27 @@ class StockItemMoveMultiple(AjaxView, FormMixin):
|
||||
ajax_form_title = 'Move Stock'
|
||||
form_class = MoveStockItemForm
|
||||
|
||||
def get_items(self, item_list):
|
||||
""" Return list of stock items. """
|
||||
|
||||
items = []
|
||||
|
||||
for pk in item_list:
|
||||
try:
|
||||
items.append(StockItem.objects.get(pk=pk))
|
||||
except StockItem.DoesNotExist:
|
||||
pass
|
||||
|
||||
return items
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
||||
item_list = request.GET.getlist('stock[]')
|
||||
|
||||
items = self.get_items(item_list)
|
||||
|
||||
print(items)
|
||||
|
||||
return self.renderJsonResponse(request, self.form_class())
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
Reference in New Issue
Block a user