diff --git a/InvenTree/order/api.py b/InvenTree/order/api.py
index b2e7145d52..b5622d7ce8 100644
--- a/InvenTree/order/api.py
+++ b/InvenTree/order/api.py
@@ -822,6 +822,7 @@ class SOAllocationList(generics.ListAPIView):
kwargs['item_detail'] = str2bool(params.get('item_detail', False))
kwargs['order_detail'] = str2bool(params.get('order_detail', False))
kwargs['location_detail'] = str2bool(params.get('location_detail', False))
+ kwargs['customer_detail'] = str2bool(params.get('customer_detail', False))
except AttributeError:
pass
diff --git a/InvenTree/order/serializers.py b/InvenTree/order/serializers.py
index 6097a707c7..5e78b3e3a3 100644
--- a/InvenTree/order/serializers.py
+++ b/InvenTree/order/serializers.py
@@ -495,6 +495,7 @@ class SalesOrderAllocationSerializer(InvenTreeModelSerializer):
part_detail = PartBriefSerializer(source='item.part', many=False, read_only=True)
item_detail = stock.serializers.StockItemSerializer(source='item', many=False, read_only=True)
location_detail = stock.serializers.LocationSerializer(source='item.location', many=False, read_only=True)
+ customer_detail = CompanyBriefSerializer(source='line.order.customer', many=False, read_only=True)
shipment_date = serializers.DateField(source='shipment.shipment_date', read_only=True)
@@ -504,6 +505,7 @@ class SalesOrderAllocationSerializer(InvenTreeModelSerializer):
part_detail = kwargs.pop('part_detail', True)
item_detail = kwargs.pop('item_detail', False)
location_detail = kwargs.pop('location_detail', False)
+ customer_detail = kwargs.pop('customer_detail', False)
super().__init__(*args, **kwargs)
@@ -519,12 +521,16 @@ class SalesOrderAllocationSerializer(InvenTreeModelSerializer):
if not location_detail:
self.fields.pop('location_detail')
+ if not customer_detail:
+ self.fields.pop('customer_detail')
+
class Meta:
model = order.models.SalesOrderAllocation
fields = [
'pk',
'line',
+ 'customer_detail',
'serial',
'quantity',
'location',
diff --git a/InvenTree/templates/js/translated/helpers.js b/InvenTree/templates/js/translated/helpers.js
index a1679a25b9..2d35513e78 100644
--- a/InvenTree/templates/js/translated/helpers.js
+++ b/InvenTree/templates/js/translated/helpers.js
@@ -62,15 +62,16 @@ function imageHoverIcon(url) {
* @param {String} url is the image URL
* @returns html
tag
*/
-function thumbnailImage(url) {
+function thumbnailImage(url, options={}) {
if (!url) {
url = blankImage();
}
// TODO: Support insertion of custom classes
+ var title = options.title || '';
- var html = `
`;
+ var html = `
`;
return html;
diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js
index d9fee44297..9be480fd31 100644
--- a/InvenTree/templates/js/translated/stock.js
+++ b/InvenTree/templates/js/translated/stock.js
@@ -2251,8 +2251,12 @@ function loadStockAllocationTable(table, options={}) {
onLoadSuccess: function(tableData) {
var query_params = params;
+
+ query_params.customer_detail = true;
query_params.order_detail = true;
+ delete query_params.build_detail;
+
// Load sales order allocation data
inventreeGet('{% url "api-so-allocation-list" %}', query_params, {
success: function(data) {
@@ -2270,18 +2274,34 @@ function loadStockAllocationTable(table, options={}) {
var html = '';
if (row.build) {
- html = renderLink(
+
+ // Add an icon for the part being built
+ html += thumbnailImage(row.build_detail.part_detail.thumbnail, {
+ title: row.build_detail.part_detail.full_name
+ });
+
+ html += ' ';
+
+ html += renderLink(
global_settings.BUILDORDER_REFERENCE_PREFIX + row.build_detail.reference,
`/build/${row.build}/`
);
html += makeIconBadge('fa-tools', '{% trans "Build Order" %}');
} else if (row.order) {
- html += renderLink(
- global_settings.SALESORDER_REFERENCE_PREFIX + row.order,
- `/order/so/${row.order}/`
- );
+ // Add an icon for the customer
+ html += thumbnailImage(
+ row.customer_detail.thumbnail || row.customer_detail.image, {
+ title: row.customer_detail.name,
+ });
+
+ html += ' ';
+
+ html += renderLink(
+ global_settings.SALESORDER_REFERENCE_PREFIX + row.order_detail.reference,
+ `/order/sales-order/${row.order}/`
+ );
html += makeIconBadge('fa-truck', '{% trans "Sales Order" %}');
} else {
return '-';
@@ -2290,6 +2310,19 @@ function loadStockAllocationTable(table, options={}) {
return html;
}
},
+ {
+ field: 'description',
+ title: '{% trans "Description" %}',
+ formatter: function(value, row) {
+ if (row.order_detail) {
+ return row.order_detail.description;
+ } else if (row.build_detail) {
+ return row.build_detail.title;
+ } else {
+ return '-';
+ }
+ }
+ },
{
field: 'status',
title: '{% trans "Order Status" %}',