mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-05 14:58:50 +00:00
[CUI] Shipment fixes (#8309)
* Fix warning in "complete shipment" dialog - Broken due to recent API change / refactor * Request item detail for sub-table * Fix "ship items" button
This commit is contained in:
parent
48dd3d37c4
commit
d58d34af25
@ -281,55 +281,13 @@ function completeSalesOrderShipment(shipment_id, options={}) {
|
|||||||
// Request the list of stock items which will be shipped
|
// Request the list of stock items which will be shipped
|
||||||
inventreeGet(`{% url "api-so-shipment-list" %}${shipment_id}/`, {}, {
|
inventreeGet(`{% url "api-so-shipment-list" %}${shipment_id}/`, {}, {
|
||||||
success: function(shipment) {
|
success: function(shipment) {
|
||||||
var allocations = shipment.allocations;
|
let allocations = shipment.allocated_items ?? 0;
|
||||||
|
|
||||||
var html = '';
|
var html = allocations == 0 ? (
|
||||||
|
`<div class='alert alert-block alert-danger'>
|
||||||
if (!allocations || allocations.length == 0) {
|
{% trans "No stock items have been allocated to this shipment" %}
|
||||||
html = `
|
</div>`
|
||||||
<div class='alert alert-block alert-danger'>
|
) : '';
|
||||||
{% trans "No stock items have been allocated to this shipment" %}
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
} else {
|
|
||||||
html = `
|
|
||||||
{% trans "The following stock items will be shipped" %}
|
|
||||||
<table class='table table-striped table-condensed'>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>{% trans "Part" %}</th>
|
|
||||||
<th>{% trans "Stock Item" %}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
`;
|
|
||||||
|
|
||||||
allocations.forEach(function(allocation) {
|
|
||||||
|
|
||||||
var part = allocation.part_detail;
|
|
||||||
var thumb = thumbnailImage(part.thumbnail || part.image);
|
|
||||||
|
|
||||||
var stock = '';
|
|
||||||
|
|
||||||
if (allocation.serial) {
|
|
||||||
stock = `{% trans "Serial Number" %}: ${allocation.serial}`;
|
|
||||||
} else {
|
|
||||||
stock = `{% trans "Quantity" %}: ${allocation.quantity}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
html += `
|
|
||||||
<tr>
|
|
||||||
<td>${thumb} ${part.full_name}</td>
|
|
||||||
<td>${stock}</td>
|
|
||||||
</tr>
|
|
||||||
`;
|
|
||||||
});
|
|
||||||
|
|
||||||
html += `
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructForm(`{% url "api-so-shipment-list" %}${shipment_id}/ship/`, {
|
constructForm(`{% url "api-so-shipment-list" %}${shipment_id}/ship/`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -398,7 +356,8 @@ function completePendingShipments(order_id, options={}) {
|
|||||||
var allocated_shipments = [];
|
var allocated_shipments = [];
|
||||||
|
|
||||||
for (var idx = 0; idx < pending_shipments.length; idx++) {
|
for (var idx = 0; idx < pending_shipments.length; idx++) {
|
||||||
if (pending_shipments[idx].allocations.length > 0) {
|
|
||||||
|
if (pending_shipments[idx].allocated_items > 0) {
|
||||||
allocated_shipments.push(pending_shipments[idx]);
|
allocated_shipments.push(pending_shipments[idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1638,6 +1597,7 @@ function showAllocationSubTable(index, row, element, options) {
|
|||||||
...options.queryParams,
|
...options.queryParams,
|
||||||
part_detail: true,
|
part_detail: true,
|
||||||
location_detail: true,
|
location_detail: true,
|
||||||
|
item_detail: true,
|
||||||
order_detail: true,
|
order_detail: true,
|
||||||
},
|
},
|
||||||
data: row.allocations,
|
data: row.allocations,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user