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

More stuff:

- Pass tracking number through when completing a shipment
- Reload tables automatically when certain actions are performed
- Limit stock items to only those with available stock
This commit is contained in:
Oliver
2021-12-02 21:59:59 +11:00
parent d5ace1a8da
commit e74e7138a9
4 changed files with 29 additions and 6 deletions

View File

@ -67,7 +67,10 @@ function completeShipment(shipment_id) {
confirm: true,
confirmMessage: '{% trans "Confirm Shipment" %}',
onSuccess: function(data) {
// TODO
// Reload tables
$('#so-lines-table').bootstrapTable('refresh');
$('#pending-shipments-table').bootstrapTable('refresh');
$('#completed-shipments-table').bootstrapTable('refresh');
}
});
}
@ -1249,7 +1252,9 @@ function loadSalesOrderShipmentTable(table, options={}) {
html += makeIconButton('fa-edit icon-blue', 'button-shipment-edit', pk, '{% trans "Edit shipment" %}');
html += makeIconButton('fa-truck icon-green', 'button-shipment-ship', pk, '{% trans "Complete shipment" %}');
if (!options.shipped) {
html += makeIconButton('fa-truck icon-green', 'button-shipment-ship', pk, '{% trans "Complete shipment" %}');
}
html += `</div>`;
@ -1300,7 +1305,10 @@ function loadSalesOrderShipmentTable(table, options={}) {
onPostBody: function() {
setupShipmentCallbacks();
$(table).bootstrapTable('expandAllRows');
// Auto-expand rows on the "pending" table
if (!options.shipped) {
$(table).bootstrapTable('expandAllRows');
}
},
formatNoMatches: function() {
return '{% trans "No matching shipments found" %}';
@ -1557,6 +1565,7 @@ function allocateStockToSalesOrder(order_id, line_items, options={}) {
in_stock: true,
part_detail: true,
location_detail: true,
available: true,
},
model: 'stockitem',
required: true,
@ -2296,7 +2305,11 @@ function loadSalesOrderLineItemTable(table, options={}) {
],
{
success: function() {
// Reload this table
$(table).bootstrapTable('refresh');
// Reload the pending shipment table
$('#pending-shipments-table').bootstrapTable('refresh');
}
}
);

View File

@ -1282,7 +1282,7 @@ function loadStockTable(table, options) {
if (row.serial != null && row.quantity == 1) {
html += makeIconBadge('fa-bookmark icon-yellow', '{% trans "Serialized stock item has been allocated" %}');
} else if (row.allocated >= row.quantity) {
html += makeIconBadge('fa-bookmark icon-red', '{% trans "Stock item has been fully allocated" %}');
html += makeIconBadge('fa-bookmark icon-yellow', '{% trans "Stock item has been fully allocated" %}');
} else {
html += makeIconBadge('fa-bookmark', '{% trans "Stock item has been partially allocated" %}');
}