diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index 993d917796..43124be61b 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 = 543 +INVENTREE_API_VERSION = 544 """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" INVENTREE_API_TEXT = """ +v544 -> 2026-09-07 : https://github.com/inventree/InvenTree/pull/12807 + - Adds filtering by filename on the Attachment list API endpoint + v543 -> 2026-09-05 : https://github.com/inventree/InvenTree/pull/12762 - Adds admin APIs for managing SSO applications diff --git a/src/backend/InvenTree/common/api.py b/src/backend/InvenTree/common/api.py index 30059340a1..a095d121a0 100644 --- a/src/backend/InvenTree/common/api.py +++ b/src/backend/InvenTree/common/api.py @@ -873,6 +873,10 @@ class AttachmentFilter(FilterSet): tag_name = common.filters.TagsFilter() + filename = rest_filters.CharFilter( + field_name='attachment', lookup_expr='icontains', label=_('Filename') + ) + def get_viewable_attachment_model_types(user) -> set: """Return the set of attachment 'model_type' labels the user has 'view' permission for. @@ -909,7 +913,7 @@ class AttachmentList(AttachmentMixin, BulkDeleteMixin, ListCreateAPI): filterset_class = AttachmentFilter ordering_fields = ['model_id', 'model_type', 'upload_date', 'file_size'] - search_fields = ['comment', 'model_id', 'model_type'] + search_fields = ['comment', 'model_id', 'model_type', 'attachment'] def get_queryset(self): """Restrict the queryset to attachments linked to a model the user can view."""