Bug fix for sales order allocation table (#3295)

- Display serial number where available
This commit is contained in:
Oliver 2022-07-05 17:00:25 +10:00 committed by GitHub
parent 5045f85346
commit 1235d47eca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -741,7 +741,7 @@ class SalesOrderAllocationSerializer(InvenTreeModelSerializer):
"""Initialization routine for the serializer"""
order_detail = kwargs.pop('order_detail', False)
part_detail = kwargs.pop('part_detail', True)
item_detail = kwargs.pop('item_detail', False)
item_detail = kwargs.pop('item_detail', True)
location_detail = kwargs.pop('location_detail', False)
customer_detail = kwargs.pop('customer_detail', False)

View File

@ -3236,10 +3236,12 @@ function showAllocationSubTable(index, row, element, options) {
formatter: function(value, row, index, field) {
var text = '';
if (row.serial != null && row.quantity == 1) {
text = `{% trans "Serial Number" %}: ${row.serial}`;
} else {
text = `{% trans "Quantity" %}: ${row.quantity}`;
var item = row.item_detail;
var text = `{% trans "Quantity" %}: ${row.quantity}`;
if (item && item.serial != null && row.quantity == 1) {
text = `{% trans "Serial Number" %}: ${item.serial}`;
}
return renderLink(text, `/stock/item/${row.item}/`);