diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index 6c944666b2ba..218d09178247 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -1,11 +1,14 @@ """InvenTree API version information.""" # InvenTree API version -INVENTREE_API_VERSION = 542 +INVENTREE_API_VERSION = 543 """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" INVENTREE_API_TEXT = """ +v543 -> 2026-09-05 : https://github.com/inventree/InvenTree/pull/12737 + - Adds search and ordering fields across remaining API endpoints (machine, stock, importer, report) + v542 -> 2026-09-03 : https://github.com/inventree/InvenTree/pull/12731 - Adds management APIs for oAuth2 provider applications diff --git a/src/backend/InvenTree/importer/api.py b/src/backend/InvenTree/importer/api.py index fd8c6024fddd..763ed99a5038 100644 --- a/src/backend/InvenTree/importer/api.py +++ b/src/backend/InvenTree/importer/api.py @@ -189,6 +189,10 @@ class DataImportColumnMappingList(DataImportSessionChildMixin, ListAPI): filterset_fields = ['session'] + ordering_fields = ['column_label', 'field_name', 'session'] + + search_fields = ['column_label', 'field_name'] + class DataImportColumnMappingDetail(DataImportSessionChildMixin, RetrieveUpdateAPI): """Detail endpoint for a single DataImportColumnMap object.""" diff --git a/src/backend/InvenTree/machine/api.py b/src/backend/InvenTree/machine/api.py index bc78c7737c75..0fffdf80fd49 100644 --- a/src/backend/InvenTree/machine/api.py +++ b/src/backend/InvenTree/machine/api.py @@ -40,7 +40,7 @@ def get_serializer_class(self): ordering = ['-active', 'machine_type'] - search_fields = ['name'] + search_fields = ['name', 'machine_type', 'driver'] class MachineDetail(RetrieveUpdateDestroyAPI): diff --git a/src/backend/InvenTree/report/api.py b/src/backend/InvenTree/report/api.py index a62d2b7a9850..f6685018692a 100644 --- a/src/backend/InvenTree/report/api.py +++ b/src/backend/InvenTree/report/api.py @@ -372,6 +372,9 @@ class ReportAssetList(TemplatePermissionMixin, ListCreateAPI): queryset = report.models.ReportAsset.objects.all() serializer_class = report.serializers.ReportAssetSerializer + filter_backends = SEARCH_ORDER_FILTER + search_fields = ['description'] + ordering_fields = ['description'] class ReportAssetDetail(TemplatePermissionMixin, RetrieveUpdateDestroyAPI): diff --git a/src/backend/InvenTree/stock/api.py b/src/backend/InvenTree/stock/api.py index 8355fbfbed22..63e34080a833 100644 --- a/src/backend/InvenTree/stock/api.py +++ b/src/backend/InvenTree/stock/api.py @@ -546,7 +546,7 @@ class StockLocationTypeList(ListCreateAPI): ordering = ['-location_count'] - search_fields = ['name'] + search_fields = ['name', 'description'] def get_queryset(self): """Override the queryset method to include location count.""" @@ -1226,33 +1226,32 @@ def create(self, request, *args, **kwargs): serials = extract_serial_numbers( serial_numbers, quantity, part.get_latest_serial_number(), part=part ) - - # Determine if any of the specified serial numbers are invalid - # Note "invalid" means either they already exist, or do not pass custom rules - invalid = [] - errors = [] - - try: - invalid = part.find_conflicting_serial_numbers(serials) - except DjangoValidationError as exc: - errors.append(exc.message) - - if len(invalid) > 0: - msg = _('The following serial numbers already exist or are invalid') - msg += ' : ' - msg += ','.join([str(e) for e in invalid]) - - errors.append(msg) - - if len(errors) > 0: - raise ValidationError({'serial_numbers': errors}) - except DjangoValidationError as e: raise ValidationError({ 'quantity': e.messages, 'serial_numbers': e.messages, }) + # Determine if any of the specified serial numbers are invalid + # Note "invalid" means either they already exist, or do not pass custom rules + invalid = [] + errors = [] + + try: + invalid = part.find_conflicting_serial_numbers(serials) + except DjangoValidationError as exc: + errors.append(exc.message) + + if len(invalid) > 0: + msg = _('The following serial numbers already exist or are invalid') + msg += ' : ' + msg += ','.join([str(e) for e in invalid]) + + errors.append(msg) + + if len(errors) > 0: + raise ValidationError({'serial_numbers': errors}) + if serials is not None: """If the stock item is going to be serialized, set the quantity to 1.""" data['quantity'] = 1