mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge branch 'master' of https://github.com/inventree/InvenTree into matmair/issue2250
This commit is contained in:
commit
79a60ff895
@ -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;
|
||||
}
|
||||
|
@ -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']
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user