mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 12:36:45 +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,
|
part_detail: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
sales_order: {
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
batch: {},
|
batch: {},
|
||||||
target_date: {},
|
target_date: {},
|
||||||
take_from: {},
|
take_from: {},
|
||||||
@ -76,23 +79,32 @@ function newBuildOrder(options={}) {
|
|||||||
|
|
||||||
var fields = buildFormFields();
|
var fields = buildFormFields();
|
||||||
|
|
||||||
|
// Specify the target part
|
||||||
if (options.part) {
|
if (options.part) {
|
||||||
fields.part.value = options.part;
|
fields.part.value = options.part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Specify the desired quantity
|
||||||
if (options.quantity) {
|
if (options.quantity) {
|
||||||
fields.quantity.value = options.quantity;
|
fields.quantity.value = options.quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Specify the parent build order
|
||||||
if (options.parent) {
|
if (options.parent) {
|
||||||
fields.parent.value = 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/`, {
|
constructForm(`/api/build/`, {
|
||||||
fields: fields,
|
fields: fields,
|
||||||
follow: true,
|
follow: true,
|
||||||
method: 'POST',
|
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" %}';
|
return '{% trans "No purchase orders found" %}';
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
title: '',
|
title: '',
|
||||||
visible: true,
|
visible: true,
|
||||||
checkbox: true,
|
checkbox: true,
|
||||||
switchable: false,
|
switchable: false,
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
field: 'reference',
|
field: 'reference',
|
||||||
title: '{% trans "Purchase Order" %}',
|
title: '{% trans "Purchase Order" %}',
|
||||||
@ -1577,14 +1579,12 @@ function loadSalesOrderLineItemTable(table, options={}) {
|
|||||||
quantity = row.quantity - row.allocated;
|
quantity = row.quantity - row.allocated;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Migrate this to the API forms
|
// Create a new build order
|
||||||
launchModalForm(`/build/new/`, {
|
newBuildOrder({
|
||||||
follow: true,
|
|
||||||
data: {
|
|
||||||
part: pk,
|
part: pk,
|
||||||
sales_order: options.order,
|
sales_order: options.order,
|
||||||
quantity: quantity,
|
quantity: quantity,
|
||||||
},
|
success: reloadTable
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user