mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix build button
- Now links into the API forms
This commit is contained in:
parent
4d2cf233b3
commit
f9f8527ae5
@ -42,6 +42,9 @@ function buildFormFields() {
|
||||
part_detail: true,
|
||||
}
|
||||
},
|
||||
sales_order: {
|
||||
hidden: true,
|
||||
},
|
||||
batch: {},
|
||||
target_date: {},
|
||||
take_from: {},
|
||||
@ -76,23 +79,32 @@ function newBuildOrder(options={}) {
|
||||
|
||||
var fields = buildFormFields();
|
||||
|
||||
// Specify the target part
|
||||
if (options.part) {
|
||||
fields.part.value = options.part;
|
||||
}
|
||||
|
||||
// Specify the desired quantity
|
||||
if (options.quantity) {
|
||||
fields.quantity.value = options.quantity;
|
||||
}
|
||||
|
||||
// Specify the parent build order
|
||||
if (options.parent) {
|
||||
fields.parent.value = options.parent;
|
||||
}
|
||||
|
||||
// Specify a parent sales order
|
||||
if (options.sales_order) {
|
||||
fields.sales_order.value = options.sales_order;
|
||||
}
|
||||
|
||||
constructForm(`/api/build/`, {
|
||||
fields: fields,
|
||||
follow: true,
|
||||
method: 'POST',
|
||||
title: '{% trans "Create Build Order" %}'
|
||||
title: '{% trans "Create Build Order" %}',
|
||||
onSuccess: options.onSuccess,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -580,12 +580,14 @@ function loadPurchaseOrderTable(table, options) {
|
||||
return '{% trans "No purchase orders found" %}';
|
||||
},
|
||||
columns: [
|
||||
/*
|
||||
{
|
||||
title: '',
|
||||
visible: true,
|
||||
checkbox: true,
|
||||
switchable: false,
|
||||
},
|
||||
*/
|
||||
{
|
||||
field: 'reference',
|
||||
title: '{% trans "Purchase Order" %}',
|
||||
@ -1576,15 +1578,13 @@ function loadSalesOrderLineItemTable(table, options={}) {
|
||||
if (row.allocated < row.quantity) {
|
||||
quantity = row.quantity - row.allocated;
|
||||
}
|
||||
|
||||
// TODO: Migrate this to the API forms
|
||||
launchModalForm(`/build/new/`, {
|
||||
follow: true,
|
||||
data: {
|
||||
part: pk,
|
||||
sales_order: options.order,
|
||||
quantity: quantity,
|
||||
},
|
||||
|
||||
// Create a new build order
|
||||
newBuildOrder({
|
||||
part: pk,
|
||||
sales_order: options.order,
|
||||
quantity: quantity,
|
||||
success: reloadTable
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user