2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Allocation by serial number now moved to the API

This commit is contained in:
Oliver
2021-12-04 13:08:00 +11:00
parent e9796676c0
commit 008c52ef39
8 changed files with 213 additions and 246 deletions

View File

@ -2357,15 +2357,30 @@ function loadSalesOrderLineItemTable(table, options={}) {
$(table).find('.button-add-by-sn').click(function() {
var pk = $(this).attr('pk');
// TODO: Migrate this form to the API forms
inventreeGet(`/api/order/so-line/${pk}/`, {},
{
success: function(response) {
launchModalForm('{% url "so-assign-serials" %}', {
success: reloadTable,
data: {
line: pk,
part: response.part,
constructForm(`/api/order/so/${options.order}/allocate-serials/`, {
method: 'POST',
title: '{% trans "Allocate Serial Numbers" %}',
fields: {
line_item: {
value: pk,
hidden: true,
},
quantity: {},
serial_numbers: {},
shipment: {
filters: {
order: options.order,
shipped: false,
},
auto_fill: true,
}
},
onSuccess: function() {
$(table).bootstrapTable('refresh');
}
});
}