mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Order from a part page
This commit is contained in:
parent
3460a48b63
commit
e4f5cc8ccd
@ -194,9 +194,21 @@ class OrderParts(AjaxView):
|
||||
for item in stock_items:
|
||||
part_ids.add(item.part.id)
|
||||
|
||||
# User has passed a single Part ID
|
||||
elif 'part' in self.request.GET:
|
||||
try:
|
||||
part_id = self.request.GET.get('part')
|
||||
part = Part.objects.get(id=part_id)
|
||||
|
||||
part_ids.add(part.id)
|
||||
|
||||
except Part.DoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
# User has passed a list of part ID values
|
||||
if 'parts[]' in self.request.GET:
|
||||
elif 'parts[]' in self.request.GET:
|
||||
part_id_list = self.request.GET.getlist('parts[]')
|
||||
|
||||
print("Provided list of part:")
|
||||
|
@ -15,6 +15,9 @@
|
||||
<ul class="dropdown-menu">
|
||||
{% if part.active %}
|
||||
<li><a href="#" id='edit-part' title='Edit part'>Edit</a></li>
|
||||
{% if part.purchaseable %}
|
||||
<li><a href='#' id='order-part' title='Order part'>Order</a></li>
|
||||
{% endif %}
|
||||
<li><a href='#' id='duplicate-part' title='Duplicate Part'>Duplicate</a></li>
|
||||
<hr>
|
||||
<li><a href="#" id='deactivate-part' title='Deactivate part'>Deactivate</a></li>
|
||||
@ -158,6 +161,14 @@
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$("#order-part").click(function() {
|
||||
launchModalForm("/order/purchase-order/order-parts/", {
|
||||
data: {
|
||||
part: {{ part.id }},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$("#edit-part").click(function() {
|
||||
launchModalForm(
|
||||
|
Loading…
Reference in New Issue
Block a user