2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-10 17:28:50 +00:00

Fix Generate API schema name mismatch (#9651)

* Match serializer (and schema) to API-returned json data

* Bump schema version
This commit is contained in:
Joe Rogers 2025-05-09 21:11:16 +02:00 committed by GitHub
parent d619932ae4
commit e0acfaa762
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View File

@ -1,12 +1,15 @@
"""InvenTree API version information.""" """InvenTree API version information."""
# InvenTree API version # InvenTree API version
INVENTREE_API_VERSION = 341 INVENTREE_API_VERSION = 342
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" """Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """ INVENTREE_API_TEXT = """
v342 -> 2025-05-09 : https://github.com/inventree/InvenTree/pull/9651
- Fix serializer to match Generate API for serial numbers
v341 -> 2025-04-21 : https://github.com/inventree/InvenTree/pull/9547 v341 -> 2025-04-21 : https://github.com/inventree/InvenTree/pull/9547
- Require pagination limit on list queries - Require pagination limit on list queries

View File

@ -143,20 +143,24 @@ class GenerateSerialNumberSerializer(serializers.Serializer):
Any of the provided write-only fields can be used for additional context. Any of the provided write-only fields can be used for additional context.
Note that in the case where multiple serial numbers are required, Note that in the case where multiple serial numbers are required,
the "serial" field will return a string with multiple serial numbers separated by a comma. the "serial_number" field will return a string with multiple serial numbers
separated by a comma.
""" """
class Meta: class Meta:
"""Metaclass options.""" """Metaclass options."""
fields = ['serial', 'part', 'quantity'] fields = ['serial_number', 'part', 'quantity']
read_only_fields = ['serial'] read_only_fields = ['serial_number']
write_only_fields = ['part', 'quantity'] write_only_fields = ['part', 'quantity']
serial = serializers.CharField( serial_number = serializers.CharField(
read_only=True, help_text=_('Generated serial number'), label=_('Serial Number') read_only=True,
allow_null=True,
help_text=_('Generated serial number'),
label=_('Serial Number'),
) )
part = serializers.PrimaryKeyRelatedField( part = serializers.PrimaryKeyRelatedField(