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

Construct table of "shipments"

This commit is contained in:
Oliver
2021-10-26 00:17:17 +11:00
parent e9e4d13541
commit e7c25126a4
5 changed files with 170 additions and 7 deletions

View File

@ -810,7 +810,7 @@ order_api_urls = [
])),
url(r'^shipment/', include([
url(r'^(?P<pk>\d)+/', include([
url(r'^(?P<pk>\d+)/', include([
url(r'^.*$', SOShipmentDetail.as_view(), name='api-so-shipment-detail'),
])),
url(r'^.*$', SOShipmentList.as_view(), name='api-so-shipment-list'),

View File

@ -41,6 +41,9 @@ def add_shipment(apps, schema_editor):
order=order,
)
if order.status == SalesOrderStatus.SHIPPED:
shipment.shipment_date = order.shipment_date
shipment.save()
# Iterate through each allocation associated with this order

View File

@ -33,6 +33,32 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-order-shipments'>
{% if order.is_pending %}
<div class='panel-heading'>
<h4>{% trans "Pending Shipments" %}</h4>
</div>
<div class='panel-content'>
{% if roles.sales_order.change %}
<div id='pending-shipment-toolbar' class='btn-group' style='float: right;'>
<div class='btn-group'>
<button type='button' class='btn btn-success' id='new-shipment'>
<span class='fas fa-plus-circle'></span> {% trans "New Shipment" %}
</button>
</div>
</div>
{% endif %}
<table class='table table-striped table-condensed' id='pending-shipments-table' data-toolbar='#pending-shipment-toolbar'></table>
</div>
{% endif %}
<div class='panel-heading'>
<h4>{% trans "Completed Shipments" %}</h4>
</div>
<div class='panel-content'>
<table class='table table-striped table-condensed' id='completed-shipments-table'></table>
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-order-builds'>
<div class='panel-heading'>
<h4>{% trans "Build Orders" %}</h4>
@ -79,6 +105,23 @@
{% block js_ready %}
{{ block.super }}
// Callback when the "shipments" panel is first loaded
onPanelLoad('order-shipments', function() {
{% if order.is_pending %}
loadSalesOrderShipmentTable('#pending-shipments-table', {
order: {{ order.pk }},
shipped: false,
});
{% endif %}
loadSalesOrderShipmentTable('#completed-shipments-table', {
order: {{ order.pk }},
shipped: true,
});
});
$('#edit-notes').click(function() {
constructForm('{% url "api-so-detail" order.pk %}', {
fields: {

View File

@ -16,6 +16,13 @@
</a>
</li>
<li class='list-group-item' title='{% trans "Shipments" %}'>
<a href='#' id='select-order-shipments' class='nav-toggle'>
<span class='fas fa-truck sidebar-icon'></span>
{% trans "Shipments" %}
</a>
</li>
<li class='list-group-item' title='{% trans "Build Orders" %}'>
<a href='#' id='select-order-builds' class='nav-toggle'>
<span class='fas fa-tools sidebar-icon'></span>