2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-24 18:07:38 +00:00

add option to ignore special cases

This commit is contained in:
Matthias Mair
2025-10-14 21:12:40 +02:00
parent f30f41ef5d
commit 016ca1563f
2 changed files with 4 additions and 1 deletions

View File

@@ -49,6 +49,7 @@ class PathScopedMixin:
"""Mixin to disable a serializer field based on kwargs passed to the view.""" """Mixin to disable a serializer field based on kwargs passed to the view."""
_was_filtered = False _was_filtered = False
no_filters = False
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Initialization routine for the serializer.""" """Initialization routine for the serializer."""
@@ -81,7 +82,7 @@ class PathScopedMixin:
tgs_vals[k] = str2bool(val) if isinstance(val, str) else val tgs_vals[k] = str2bool(val) if isinstance(val, str) else val
self.filter_target_values = tgs_vals self.filter_target_values = tgs_vals
if len(self.filter_targets) == 0: if len(self.filter_targets) == 0 and not self.no_filters:
raise Exception( raise Exception(
'INVE-W999: No filter targets found in fields, remove `PathScopedMixin`' 'INVE-W999: No filter targets found in fields, remove `PathScopedMixin`'
) )

View File

@@ -340,6 +340,8 @@ class SupplierPartSerializer(
): ):
"""Serializer for SupplierPart object.""" """Serializer for SupplierPart object."""
no_filters = True
export_exclude_fields = ['tags'] export_exclude_fields = ['tags']
export_child_fields = [ export_child_fields = [