2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 04:26:44 +00:00

Fix build button

- Now links into the API forms
This commit is contained in:
Oliver 2021-10-06 16:20:15 +11:00
parent 4d2cf233b3
commit f9f8527ae5
2 changed files with 22 additions and 10 deletions

View File

@ -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,
}); });
} }

View File

@ -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" %}',
@ -1576,15 +1578,13 @@ function loadSalesOrderLineItemTable(table, options={}) {
if (row.allocated < row.quantity) { if (row.allocated < row.quantity) {
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, part: pk,
data: { sales_order: options.order,
part: pk, quantity: quantity,
sales_order: options.order, success: reloadTable
quantity: quantity,
},
}); });
}); });