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
|
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Options
|
||||||
<span class="caret"></span></button>
|
<span class="caret"></span></button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href='#' id='multi-part-order' title='Order parts'>Order Parts</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -101,4 +102,20 @@
|
|||||||
url: "{% url 'api-part-supplier-list' %}"
|
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 %}
|
{% endblock %}
|
@ -160,8 +160,6 @@ class OrderParts(AjaxView):
|
|||||||
|
|
||||||
ctx = {}
|
ctx = {}
|
||||||
|
|
||||||
print("Getting context data")
|
|
||||||
|
|
||||||
ctx['parts'] = self.get_parts()
|
ctx['parts'] = self.get_parts()
|
||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
@ -180,9 +178,6 @@ class OrderParts(AjaxView):
|
|||||||
|
|
||||||
stock_id_list = self.request.GET.getlist('stock[]')
|
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.
|
""" Get a list of all the parts associated with the stock items.
|
||||||
- Base part must be purchaseable.
|
- Base part must be purchaseable.
|
||||||
- Return a set of corresponding Part IDs
|
- Return a set of corresponding Part IDs
|
||||||
@ -205,15 +200,10 @@ class OrderParts(AjaxView):
|
|||||||
except Part.DoesNotExist:
|
except Part.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# User has passed a list of part ID values
|
# User has passed a list of part ID values
|
||||||
elif 'parts[]' in self.request.GET:
|
elif 'parts[]' in self.request.GET:
|
||||||
part_id_list = self.request.GET.getlist('parts[]')
|
part_id_list = self.request.GET.getlist('parts[]')
|
||||||
|
|
||||||
print("Provided list of part:")
|
|
||||||
print(part_id_list)
|
|
||||||
|
|
||||||
parts = Part.objects.filter(
|
parts = Part.objects.filter(
|
||||||
purchaseable=True,
|
purchaseable=True,
|
||||||
id__in=part_id_list)
|
id__in=part_id_list)
|
||||||
@ -221,8 +211,6 @@ class OrderParts(AjaxView):
|
|||||||
for part in parts:
|
for part in parts:
|
||||||
part_ids.add(part.id)
|
part_ids.add(part.id)
|
||||||
|
|
||||||
print("Parts:", part_ids)
|
|
||||||
|
|
||||||
# Create the list of parts
|
# Create the list of parts
|
||||||
for id in part_ids:
|
for id in part_ids:
|
||||||
try:
|
try:
|
||||||
@ -238,10 +226,6 @@ class OrderParts(AjaxView):
|
|||||||
|
|
||||||
self.request = request
|
self.request = request
|
||||||
|
|
||||||
print("GET HERE")
|
|
||||||
|
|
||||||
print(request.GET)
|
|
||||||
|
|
||||||
self.get_parts()
|
self.get_parts()
|
||||||
|
|
||||||
return self.renderJsonResponse(request)
|
return self.renderJsonResponse(request)
|
||||||
@ -249,7 +233,6 @@ class OrderParts(AjaxView):
|
|||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
|
|
||||||
self.request = request
|
self.request = request
|
||||||
print("POST here")
|
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'form_valid': False,
|
'form_valid': False,
|
||||||
|
Loading…
Reference in New Issue
Block a user