2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 11:10:54 +00:00

Schema: Add possible order fields to 'ordering' field description (#9803)

* Make optional build order reference nullable

* Add valid choices to ordering field description

* Bump API version
This commit is contained in:
Joe Rogers
2025-06-19 05:05:02 +02:00
committed by GitHub
parent f7c8788ad5
commit 0bbc020a95
3 changed files with 15 additions and 2 deletions

View File

@ -1,11 +1,14 @@
"""InvenTree API version information."""
# InvenTree API version
INVENTREE_API_VERSION = 351
INVENTREE_API_VERSION = 352
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """
v352 -> 2025-06-18 : https://github.com/inventree/InvenTree/pull/9803
- Make PurchaseOrderLineItem link to BuildOrder reference nullable
- Add valid fields to ordering field descriptions
v351 -> 2025-06-18 : https://github.com/inventree/InvenTree/pull/9602
- Adds passwort reset API endpoint for admin users

View File

@ -91,6 +91,16 @@ class ExtendedAutoSchema(AutoSchema):
if parameter['name'] == 'limit':
parameter['required'] = True
# Add valid order selections to the ordering field description.
ordering_fields = getattr(self.view, 'ordering_fields', None)
if ordering_fields is not None:
parameters = operation.get('parameters', [])
for parameter in parameters:
if parameter['name'] == 'ordering':
parameter['description'] = (
f'{parameter["description"]} Possible fields: {", ".join(ordering_fields)}.'
)
return operation

View File

@ -649,7 +649,7 @@ class PurchaseOrderLineItemSerializer(
)
build_order_detail = build.serializers.BuildSerializer(
source='build_order', read_only=True, many=False
source='build_order', read_only=True, allow_null=True, many=False
)
merge_items = serializers.BooleanField(