mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add list of pending shipment to home page, with corresponding settings for user (#4775)
This commit is contained in:
parent
89dfb6186f
commit
84f8e33269
@ -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'),
|
||||
|
@ -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 %}
|
||||
|
@ -37,6 +37,7 @@
|
||||
<tr><td colspan='5'></td></tr>
|
||||
{% 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 %}
|
||||
<tr><td colspan='5'></td></tr>
|
||||
{% include "InvenTree/settings/setting.html" with key="HOMEPAGE_NEWS" user_setting=True %}
|
||||
</tbody>
|
||||
|
@ -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" %}',
|
||||
|
Loading…
Reference in New Issue
Block a user