diff --git a/InvenTree/build/templates/build/detail.html b/InvenTree/build/templates/build/detail.html
index f9bac157a8..26040d0fc6 100644
--- a/InvenTree/build/templates/build/detail.html
+++ b/InvenTree/build/templates/build/detail.html
@@ -275,13 +275,8 @@
{% if build.has_tracked_bom_items %}
-
-
-
+ {% include "expand_rows.html" with label="outputs" %}
+ {% include "collapse_rows.html" with label="outputs" %}
{% endif %}
{% include "filter_list.html" with id='incompletebuilditems' %}
diff --git a/InvenTree/order/templates/order/sales_order_detail.html b/InvenTree/order/templates/order/sales_order_detail.html
index 89346c8118..40b3fa5cab 100644
--- a/InvenTree/order/templates/order/sales_order_detail.html
+++ b/InvenTree/order/templates/order/sales_order_detail.html
@@ -28,6 +28,8 @@
+ {% include "expand_rows.html" with label="sales-lines" %}
+ {% include "collapse_rows.html" with label="sales-lines" %}
{% include "filter_list.html" with id="sales-order-lines" %}
@@ -86,6 +88,8 @@
{% if roles.sales_order.change %}
+ {% include "expand_rows.html" with label="pending-shipments" %}
+ {% include "collapse_rows.html" with label="pending-shipments" %}
{% include "filter_list.html" with id="pending-shipments" %}
@@ -102,6 +106,8 @@
+ {% include "expand_rows.html" with label="completed-shipments" %}
+ {% include "collapse_rows.html" with label="completed-shipments" %}
{% include "filter_list.html" with id="completed-shipments" %}
diff --git a/InvenTree/templates/collapse_rows.html b/InvenTree/templates/collapse_rows.html
new file mode 100644
index 0000000000..f9fb454268
--- /dev/null
+++ b/InvenTree/templates/collapse_rows.html
@@ -0,0 +1,5 @@
+{% load i18n %}
+
+
diff --git a/InvenTree/templates/expand_rows.html b/InvenTree/templates/expand_rows.html
new file mode 100644
index 0000000000..bf6ac54425
--- /dev/null
+++ b/InvenTree/templates/expand_rows.html
@@ -0,0 +1,5 @@
+{% load i18n %}
+
+
diff --git a/InvenTree/templates/js/translated/order.js b/InvenTree/templates/js/translated/order.js
index 4bc9bcb9cd..0909c02808 100644
--- a/InvenTree/templates/js/translated/order.js
+++ b/InvenTree/templates/js/translated/order.js
@@ -2540,6 +2540,17 @@ function loadSalesOrderShipmentTable(table, options={}) {
setupFilterList('salesordershipment', $(table), options.filter_target);
+ // Add callbacks for expand / collapse buttons
+ var prefix = options.shipped ? 'completed' : 'pending';
+
+ $(`#${prefix}-shipments-expand`).click(function() {
+ $(table).bootstrapTable('expandAllRows');
+ });
+
+ $(`#${prefix}-shipments-collapse`).click(function() {
+ $(table).bootstrapTable('collapseAllRows');
+ });
+
function makeShipmentActions(row) {
// Construct "actions" for the given shipment row
var pk = row.pk;
@@ -3416,6 +3427,15 @@ function loadSalesOrderLineItemTable(table, options={}) {
// Show detail view if the PurchaseOrder is PENDING or SHIPPED
var show_detail = pending || shipped;
+ // Add callbacks for expand / collapse buttons
+ $('#sales-lines-expand').click(function() {
+ $(table).bootstrapTable('expandAllRows');
+ });
+
+ $('#sales-lines-collapse').click(function() {
+ $(table).bootstrapTable('collapseAllRows');
+ });
+
// Table columns to display
var columns = [
/*
@@ -3543,29 +3563,26 @@ function loadSalesOrderLineItemTable(table, options={}) {
title: '{% trans "Available Stock" %}',
formatter: function(value, row) {
var available = row.available_stock;
- var total = row.part_detail.stock;
var required = Math.max(row.quantity - row.allocated - row.shipped, 0);
var html = '';
- if (total > 0) {
+ if (available > 0) {
var url = `/part/${row.part}/?display=part-stock`;
var text = available;
- if (total != available) {
- text += ` / ${total}`;
- }
-
html = renderLink(text, url);
} else {
html += `{% trans "No Stock Available" %}`;
}
- if (available >= required) {
- html += ``;
- } else {
- html += ``;
+ if (required > 0) {
+ if (available >= required) {
+ html += ``;
+ } else {
+ html += ``;
+ }
}
return html;