diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index f05a325f78..16545e5914 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -1875,6 +1875,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): 'validator': bool, }, + 'HOMEPAGE_SO_SHIPMENTS_PENDING': { + 'name': _('Show pending SO shipments'), + 'description': _('Show pending SO shipments on the homepage'), + 'default': True, + 'validator': bool, + }, + 'HOMEPAGE_NEWS': { 'name': _('Show News'), 'description': _('Show news on the homepage'), diff --git a/InvenTree/templates/InvenTree/index.html b/InvenTree/templates/InvenTree/index.html index 2bad58f61c..0ba67f5821 100644 --- a/InvenTree/templates/InvenTree/index.html +++ b/InvenTree/templates/InvenTree/index.html @@ -301,7 +301,8 @@ loadPurchaseOrderTable("#table-po-overdue", { {% settings_value 'HOMEPAGE_SO_OUTSTANDING' user=request.user as setting_so_outstanding %} {% settings_value 'HOMEPAGE_SO_OVERDUE' user=request.user as setting_so_overdue %} -{% to_list setting_so_outstanding setting_so_overdue as settings_list_so %} +{% settings_value 'HOMEPAGE_SO_SHIPMENTS_PENDING' user=request.user as setting_so_shipments_pending %} +{% to_list setting_so_outstanding setting_so_overdue setting_so_shipments_pending as settings_list_so %} {% if roles.sales_order.view and True in settings_list_so %} addHeaderTitle('{% trans "Sales Orders" %}'); @@ -328,6 +329,17 @@ loadSalesOrderTable("#table-so-overdue", { }); {% endif %} +{% if setting_so_shipments_pending %} +addHeaderAction('so-shipments', '{% trans "Pending Shipments" %}', 'fa-truck-loading'); +loadSalesOrderShipmentTable("#table-so-shipments", { + url: "{% url 'api-so-shipment-list' %}", + params: { + shipped: false, + }, + show_so_reference: true, +}); +{% endif %} + {% endif %} {% settings_value 'HOMEPAGE_NEWS' user=request.user as setting_news %} diff --git a/InvenTree/templates/InvenTree/settings/user_homepage.html b/InvenTree/templates/InvenTree/settings/user_homepage.html index 9265484d37..4a990e5138 100644 --- a/InvenTree/templates/InvenTree/settings/user_homepage.html +++ b/InvenTree/templates/InvenTree/settings/user_homepage.html @@ -37,6 +37,7 @@ {% include "InvenTree/settings/setting.html" with key="HOMEPAGE_SO_OUTSTANDING" user_setting=True %} {% include "InvenTree/settings/setting.html" with key="HOMEPAGE_SO_OVERDUE" user_setting=True %} + {% include "InvenTree/settings/setting.html" with key="HOMEPAGE_SO_SHIPMENTS_PENDING" user_setting=True %} {% include "InvenTree/settings/setting.html" with key="HOMEPAGE_NEWS" user_setting=True %} diff --git a/InvenTree/templates/js/translated/sales_order.js b/InvenTree/templates/js/translated/sales_order.js index abbb9292c7..5d77807be6 100644 --- a/InvenTree/templates/js/translated/sales_order.js +++ b/InvenTree/templates/js/translated/sales_order.js @@ -836,6 +836,9 @@ function loadSalesOrderShipmentTable(table, options={}) { // Add callbacks for expand / collapse buttons var prefix = options.shipped ? 'completed' : 'pending'; + // Add option to show SO reference also + var show_so_reference = options.show_so_reference || false; + $(`#${prefix}-shipments-expand`).click(function() { $(table).bootstrapTable('expandAllRows'); }); @@ -931,6 +934,21 @@ function loadSalesOrderShipmentTable(table, options={}) { checkbox: true, switchable: false, }, + { + visible: show_so_reference, + field: 'order_detail', + title: '{% trans "Sales Order" %}', + switchable: false, + formatter: function(value, row) { + var html = renderLink(row.order_detail.reference, `/order/sales-order/${row.order}/`); + + if (row.overdue) { + html += makeIconBadge('fa-calendar-times icon-red', '{% trans "Order is overdue" %}'); + } + + return html; + }, + }, { field: 'reference', title: '{% trans "Shipment Reference" %}',