mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Pass list of selected stock items to the view
This commit is contained in:
parent
0ce6c5f7d5
commit
0e3f74ef31
@ -550,6 +550,24 @@ function loadStockTable(table, options) {
|
||||
|
||||
$("#multi-item-move").click(function() {
|
||||
|
||||
var items = $('#stock-table').bootstrapTable('getSelections');
|
||||
|
||||
var stock = [];
|
||||
|
||||
items.forEach(function(item) {
|
||||
stock.push(item.pk);
|
||||
});
|
||||
|
||||
launchModalForm("/stock/move/",
|
||||
{
|
||||
data: {
|
||||
stock: stock,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
var items = $("#stock-table").bootstrapTable('getSelections');
|
||||
|
||||
moveStockItems(items,
|
||||
@ -560,6 +578,7 @@ function loadStockTable(table, options) {
|
||||
});
|
||||
|
||||
return false;
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user