mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Order from supplier 'parts list' page
This commit is contained in:
parent
e4f5cc8ccd
commit
74327d3094
@ -12,6 +12,7 @@
|
||||
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Options
|
||||
<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href='#' id='multi-part-order' title='Order parts'>Order Parts</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -101,4 +102,20 @@
|
||||
url: "{% url 'api-part-supplier-list' %}"
|
||||
});
|
||||
|
||||
$("#multi-part-order").click(function() {
|
||||
var selections = $("#part-table").bootstrapTable("getSelections");
|
||||
|
||||
var parts = [];
|
||||
|
||||
selections.forEach(function(item) {
|
||||
parts.push(item.part);
|
||||
});
|
||||
|
||||
launchModalForm("/order/purchase-order/order-parts/", {
|
||||
data: {
|
||||
parts: parts,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
{% endblock %}
|
@ -160,8 +160,6 @@ class OrderParts(AjaxView):
|
||||
|
||||
ctx = {}
|
||||
|
||||
print("Getting context data")
|
||||
|
||||
ctx['parts'] = self.get_parts()
|
||||
|
||||
return ctx
|
||||
@ -180,9 +178,6 @@ class OrderParts(AjaxView):
|
||||
|
||||
stock_id_list = self.request.GET.getlist('stock[]')
|
||||
|
||||
print("Looking up parts from stock items:")
|
||||
print(stock_id_list)
|
||||
|
||||
""" Get a list of all the parts associated with the stock items.
|
||||
- Base part must be purchaseable.
|
||||
- Return a set of corresponding Part IDs
|
||||
@ -205,15 +200,10 @@ class OrderParts(AjaxView):
|
||||
except Part.DoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
# User has passed a list of part ID values
|
||||
elif 'parts[]' in self.request.GET:
|
||||
part_id_list = self.request.GET.getlist('parts[]')
|
||||
|
||||
print("Provided list of part:")
|
||||
print(part_id_list)
|
||||
|
||||
parts = Part.objects.filter(
|
||||
purchaseable=True,
|
||||
id__in=part_id_list)
|
||||
@ -221,8 +211,6 @@ class OrderParts(AjaxView):
|
||||
for part in parts:
|
||||
part_ids.add(part.id)
|
||||
|
||||
print("Parts:", part_ids)
|
||||
|
||||
# Create the list of parts
|
||||
for id in part_ids:
|
||||
try:
|
||||
@ -238,10 +226,6 @@ class OrderParts(AjaxView):
|
||||
|
||||
self.request = request
|
||||
|
||||
print("GET HERE")
|
||||
|
||||
print(request.GET)
|
||||
|
||||
self.get_parts()
|
||||
|
||||
return self.renderJsonResponse(request)
|
||||
@ -249,7 +233,6 @@ class OrderParts(AjaxView):
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
||||
self.request = request
|
||||
print("POST here")
|
||||
|
||||
data = {
|
||||
'form_valid': False,
|
||||
|
Loading…
Reference in New Issue
Block a user