Use InvenTreeCurrencySerializer for price override min/max currency (#13330)

* Use InvenTreeCurrencySerializer for price override min/max currency

Fixes #13329

* Apply suggestion from @matmair

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
Miklós MártonandMatthias Mair authored and GitHub committed 2026-11-20 17:34:33 +11:00
1 parent 7612589b54
commit c78234218d
2 files changed
+8 -27

No files matched your search

@@ -1,11 +1,14 @@
"""InvenTree API version information."""
# InvenTree API version
INVENTREE_API_VERSION = 581
INVENTREE_API_VERSION = 582
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """
v582 -> 2026-11-19 : https://github.com/inventree/InvenTree/pull/13329
- The title tag of the part's override_min/max_currency had been moved by the API generator generating diff in the schema, no functional changes
v581 -> 2026-11-17 : https://github.com/inventree/InvenTree/pull/13305
- Assign correct BOM permission role to part/copy-bom API endpoint
+4 -26
View File
@@ -5,7 +5,6 @@ from django.utils.translation import gettext_lazy as _
from djmoney.contrib.exchange.exceptions import MissingRate
from djmoney.contrib.exchange.models import convert_money
from drf_spectacular.utils import extend_schema_field
from rest_framework import serializers
import common.currency
@@ -62,21 +61,6 @@ class PartInternalPriceSerializer(
)
@extend_schema_field(
serializers.CharField(
help_text=_('Select currency from available options')
+ '\n\n'
+ '\n'.join(
f'* `{value}` - {label}'
for value, label in common.currency.currency_code_mappings()
)
+ "\n\nOther valid currencies may be found in the 'CURRENCY_CODES' global setting."
)
)
class PartPricingCurrencySerializer(serializers.ChoiceField):
"""Serializer to allow annotating the schema to use String on currency fields."""
class PartPricingSerializer(InvenTree.serializers.InvenTreeModelSerializer):
"""Serializer for Part pricing information."""
@@ -163,11 +147,8 @@ class PartPricingSerializer(InvenTree.serializers.InvenTreeModelSerializer):
required=False,
)
override_min_currency = PartPricingCurrencySerializer(
label=_('Minimum price currency'),
read_only=False,
required=False,
choices=common.currency.currency_code_mappings(),
override_min_currency = InvenTree.serializers.InvenTreeCurrencySerializer(
label=_('Minimum price currency'), read_only=False, required=False
)
override_max = InvenTree.serializers.InvenTreeMoneySerializer(
@@ -178,11 +159,8 @@ class PartPricingSerializer(InvenTree.serializers.InvenTreeModelSerializer):
required=False,
)
override_max_currency = PartPricingCurrencySerializer(
label=_('Maximum price currency'),
read_only=False,
required=False,
choices=common.currency.currency_code_mappings(),
override_max_currency = InvenTree.serializers.InvenTreeCurrencySerializer(
label=_('Maximum price currency'), read_only=False, required=False
)
overall_min = InvenTree.serializers.InvenTreeMoneySerializer(