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

var tests

This commit is contained in:
Matthias Mair
2025-10-14 00:21:38 +02:00
parent d33cd8e4b0
commit 611867509b
2 changed files with 33 additions and 4 deletions

View File

@@ -102,7 +102,6 @@ class BuildSerializer(
'priority', 'priority',
'level', 'level',
] ]
read_only_fields = [ read_only_fields = [
'completed', 'completed',
'creation_date', 'creation_date',
@@ -111,6 +110,7 @@ class BuildSerializer(
'status_text', 'status_text',
'level', 'level',
] ]
list_serializer_class = FilterableListSerializer
reference = serializers.CharField(required=True) reference = serializers.CharField(required=True)

View File

@@ -622,10 +622,12 @@ class DefaultLocationSerializer(InvenTree.serializers.InvenTreeModelSerializer):
@register_importer() @register_importer()
class PartSerializer( class PartSerializer(
InvenTree.serializers.PathScopedMixin,
DataImportExportSerializerMixin, DataImportExportSerializerMixin,
InvenTree.serializers.NotesFieldMixin, InvenTree.serializers.NotesFieldMixin,
InvenTree.serializers.RemoteImageMixin, InvenTree.serializers.RemoteImageMixin,
InvenTree.serializers.InvenTreeTagModelSerializer, InvenTree.serializers.InvenTreeTaggitSerializer,
InvenTree.serializers.BareInvenTreeModelSerializer,
): ):
"""Serializer for complete detail information of a part. """Serializer for complete detail information of a part.
@@ -708,8 +710,8 @@ class PartSerializer(
'copy_category_parameters', 'copy_category_parameters',
'tags', 'tags',
] ]
read_only_fields = ['barcode_hash', 'creation_date', 'creation_user'] read_only_fields = ['barcode_hash', 'creation_date', 'creation_user']
# list_serializer_class = FilterableListSerializer
tags = TagListSerializerField(required=False) tags = TagListSerializerField(required=False)
@@ -719,11 +721,38 @@ class PartSerializer(
- Allows us to optionally pass extra fields based on the query. - Allows us to optionally pass extra fields based on the query.
""" """
self.starred_parts = kwargs.pop('starred_parts', []) self.starred_parts = kwargs.pop('starred_parts', [])
# category_detail = kwargs.pop('category_detail', False)
# location_detail = kwargs.pop('location_detail', False)
# parameters = kwargs.pop('parameters', False)
create = kwargs.pop('create', False) create = kwargs.pop('create', False)
# pricing = kwargs.pop('pricing', True)
# path_detail = kwargs.pop('path_detail', False)
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
if not create and not isGeneratingSchema(): if isGeneratingSchema():
return
"""
if not category_detail:
self.fields.pop('category_detail', None)
if not location_detail:
self.fields.pop('default_location_detail', None)
if not parameters:
self.fields.pop('parameters', None)
if not path_detail:
self.fields.pop('category_path', None)
if not pricing:
self.fields.pop('pricing_min', None)
self.fields.pop('pricing_max', None)
self.fields.pop('pricing_updated', None)
"""
if not create:
# These fields are only used for the LIST API endpoint # These fields are only used for the LIST API endpoint
for f in self.skip_create_fields(): for f in self.skip_create_fields():
# Fields required for certain operations, but are not part of the model # Fields required for certain operations, but are not part of the model