mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Launch order dialog from the 'Parts' table
This commit is contained in:
parent
0ca01fb0e7
commit
1cb6c67086
@ -194,8 +194,22 @@ class OrderParts(AjaxView):
|
|||||||
for item in stock_items:
|
for item in stock_items:
|
||||||
part_ids.add(item.part.id)
|
part_ids.add(item.part.id)
|
||||||
|
|
||||||
print("Parts:", part_ids)
|
|
||||||
|
|
||||||
|
# User has passed a list of part ID values
|
||||||
|
if '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)
|
||||||
|
|
||||||
|
for part in parts:
|
||||||
|
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:
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
<div class='dropdown' style='float: right;'>
|
<div class='dropdown' style='float: right;'>
|
||||||
<button id='part-options' class='btn btn-primary dropdown-toggle' type='button' data-toggle="dropdown">Options<span class='caret'></span></button>
|
<button id='part-options' class='btn btn-primary dropdown-toggle' type='button' data-toggle="dropdown">Options<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>
|
||||||
<li><a href='#' id='multi-part-category' title='Set Part Category'>Set Category</a></li>
|
<li><a href='#' id='multi-part-category' title='Set Part Category'>Set Category</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -192,4 +192,22 @@ function loadPartTable(table, url, options={}) {
|
|||||||
if (options.buttons) {
|
if (options.buttons) {
|
||||||
linkButtonsToSelection($(table), options.buttons);
|
linkButtonsToSelection($(table), options.buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Button callbacks for part table buttons */
|
||||||
|
|
||||||
|
$("#multi-part-order").click(function() {
|
||||||
|
var selections = $(table).bootstrapTable("getSelections");
|
||||||
|
|
||||||
|
var parts = [];
|
||||||
|
|
||||||
|
selections.forEach(function(item) {
|
||||||
|
parts.push(item.pk);
|
||||||
|
});
|
||||||
|
|
||||||
|
launchModalForm("/order/purchase-order/order-parts/", {
|
||||||
|
data: {
|
||||||
|
parts: parts,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user