Merge branch 'master' of https://github.com/inventree/InvenTree into matmair/issue2250

This commit is contained in:
Matthias 2021-12-08 01:11:35 +01:00
commit 79a60ff895
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
4 changed files with 46 additions and 13 deletions

View File

@ -438,6 +438,12 @@
width: 30%;
}
/* tracking table column size */
#track-table .table-condensed th {
inline-size: 30%;
overflow-wrap: break-word;
}
.panel-heading .badge {
float: right;
}

View File

@ -188,21 +188,21 @@ class BarcodeAssign(APIView):
if plugin.getStockItem() is not None:
match_found = True
response['error'] = _('Barcode already matches StockItem object')
response['error'] = _('Barcode already matches Stock Item')
if plugin.getStockLocation() is not None:
match_found = True
response['error'] = _('Barcode already matches StockLocation object')
response['error'] = _('Barcode already matches Stock Location')
if plugin.getPart() is not None:
match_found = True
response['error'] = _('Barcode already matches Part object')
response['error'] = _('Barcode already matches Part')
if not match_found:
item = plugin.getStockItemByHash()
if item is not None:
response['error'] = _('Barcode hash already matches StockItem object')
response['error'] = _('Barcode hash already matches Stock Item')
match_found = True
else:
@ -214,13 +214,13 @@ class BarcodeAssign(APIView):
# Lookup stock item by hash
try:
item = StockItem.objects.get(uid=hash)
response['error'] = _('Barcode hash already matches StockItem object')
response['error'] = _('Barcode hash already matches Stock Item')
match_found = True
except StockItem.DoesNotExist:
pass
if not match_found:
response['success'] = _('Barcode associated with StockItem')
response['success'] = _('Barcode associated with Stock Item')
# Save the barcode hash
item.uid = response['hash']

View File

@ -277,13 +277,31 @@ class POLineItemFilter(rest_filters.FilterSet):
'part'
]
completed = rest_filters.BooleanFilter(label='completed', method='filter_completed')
pending = rest_filters.BooleanFilter(label='pending', method='filter_pending')
def filter_completed(self, queryset, name, value):
def filter_pending(self, queryset, name, value):
"""
Filter by "pending" status (order status = pending)
"""
Filter by lines which are "completed" (or "not" completed)
A line is completed when received >= quantity
value = str2bool(value)
if value:
queryset = queryset.filter(order__status__in=PurchaseOrderStatus.OPEN)
else:
queryset = queryset.exclude(order__status__in=PurchaseOrderStatus.OPEN)
return queryset
order_status = rest_filters.NumberFilter(label='order_status', field_name='order__status')
received = rest_filters.BooleanFilter(label='received', method='filter_received')
def filter_received(self, queryset, name, value):
"""
Filter by lines which are "received" (or "not" received)
A line is considered "received" when received >= quantity
"""
value = str2bool(value)
@ -293,7 +311,8 @@ class POLineItemFilter(rest_filters.FilterSet):
if value:
queryset = queryset.filter(q)
else:
queryset = queryset.exclude(q)
# Only count "pending" orders
queryset = queryset.exclude(q).filter(order__status__in=PurchaseOrderStatus.OPEN)
return queryset

View File

@ -308,9 +308,17 @@ function getAvailableTableFilters(tableKey) {
// Filters for PurchaseOrderLineItem table
if (tableKey == 'purchaseorderlineitem') {
return {
completed: {
pending: {
type: 'bool',
title: '{% trans "Completed" %}',
title: '{% trans "Pending" %}',
},
received: {
type: 'bool',
title: '{% trans "Received" %}',
},
order_status: {
title: '{% trans "Order status" %}',
options: purchaseOrderCodes,
},
};
}