diff --git a/InvenTree/templates/js/stock.html b/InvenTree/templates/js/stock.html
index 330be924e5..b3ea0f2baa 100644
--- a/InvenTree/templates/js/stock.html
+++ b/InvenTree/templates/js/stock.html
@@ -470,10 +470,16 @@ function loadStockTable(table, options) {
if (row.customer) {
html += ``;
- } else if (row.build_order) {
- html += ``;
- } else if (row.sales_order) {
- html += ``;
+ } else {
+ if (row.build_order) {
+ html += ``;
+ } else if (row.sales_order) {
+ html += ``;
+ }
+ }
+
+ if (row.belongs_to) {
+ html += ``;
}
// Special stock status codes
@@ -520,6 +526,9 @@ function loadStockTable(table, options) {
} else if (row.customer) {
var text = "{% trans "Shipped to customer" %}";
return renderLink(text, `/company/${row.customer}/assigned-stock/`);
+ } else if (row.sales_order) {
+ var text = `{% trans "Assigned to sales order" %}`;
+ return renderLink(text, `/order/sales-order/${row.sales_order}/`);
}
else if (value) {
return renderLink(value, `/stock/location/${row.location}/`);
@@ -844,6 +853,10 @@ function loadInstalledInTable(table, options) {
data: {
part: pk,
},
+ success: function() {
+ // Refresh entire table!
+ table.bootstrapTable('refresh');
+ }
}
);
});
@@ -895,7 +908,7 @@ function loadInstalledInTable(table, options) {
html += `{% trans "Quantity" %}: ${subrow.quantity}`;
}
- return html;
+ return renderLink(html, `/stock/item/${subrow.pk}/`);
},
},
{
@@ -969,6 +982,10 @@ function loadInstalledInTable(table, options) {
var name = row.sub_part_detail.full_name;
html = imageHoverIcon(thumb) + renderLink(name, url);
+
+ if (row.not_in_bom) {
+ html = `${html}`
+ }
return html;
}
@@ -1015,6 +1032,7 @@ function loadInstalledInTable(table, options) {
"{% url 'api-stock-list' %}",
{
installed_in: options.stock_item,
+ part_detail: true,
},
{
success: function(stock_items) {
@@ -1056,6 +1074,25 @@ function loadInstalledInTable(table, options) {
break;
}
}
+
+ if (!match) {
+ // The stock item did *not* match any items in the BOM!
+ // Add a new row to the table...
+
+ console.log("Found an unmatched part! " + item.pk + " -> " + item.part);
+
+ // Contruct a new "row" to add to the table
+ var new_row = {
+ sub_part: item.part,
+ sub_part_detail: item.part_detail,
+ not_in_bom: true,
+ installed_count: item.quantity,
+ installed_items: [item],
+ };
+
+ table.bootstrapTable('append', [new_row]);
+
+ }
});
// Update button callback links