mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	Use custom currency choices
This commit is contained in:
		| @@ -8,8 +8,6 @@ from rest_framework import serializers | ||||
|  | ||||
| from sql_util.utils import SubqueryCount | ||||
|  | ||||
| import djmoney.settings | ||||
|  | ||||
| from InvenTree.serializers import InvenTreeModelSerializer | ||||
| from InvenTree.serializers import InvenTreeImageSerializerField | ||||
|  | ||||
| @@ -19,7 +17,7 @@ from .models import Company | ||||
| from .models import ManufacturerPart, ManufacturerPartParameter | ||||
| from .models import SupplierPart, SupplierPriceBreak | ||||
|  | ||||
| from common.settings import currency_code_default | ||||
| from common.settings import currency_code_default, currency_code_mappings | ||||
|  | ||||
|  | ||||
| class CompanyBriefSerializer(InvenTreeModelSerializer): | ||||
| @@ -65,7 +63,7 @@ class CompanySerializer(InvenTreeModelSerializer): | ||||
|     parts_manufactured = serializers.IntegerField(read_only=True) | ||||
|  | ||||
|     currency = serializers.ChoiceField( | ||||
|         choices=djmoney.settings.CURRENCY_CHOICES, | ||||
|         choices=currency_code_mappings(), | ||||
|         initial=currency_code_default, | ||||
|         help_text=_('Default currency used for this supplier'), | ||||
|         label=_('Currency Code'), | ||||
| @@ -256,7 +254,7 @@ class SupplierPriceBreakSerializer(InvenTreeModelSerializer): | ||||
|     price = serializers.CharField() | ||||
|  | ||||
|     price_currency = serializers.ChoiceField( | ||||
|         choices=djmoney.settings.CURRENCY_CHOICES, | ||||
|         choices=currency_code_mappings(), | ||||
|         default=currency_code_default, | ||||
|         label=_('Currency'), | ||||
|     ) | ||||
|   | ||||
| @@ -13,8 +13,6 @@ from django.db.models import BooleanField | ||||
| from rest_framework import serializers | ||||
| from sql_util.utils import SubqueryCount | ||||
|  | ||||
| import djmoney.settings | ||||
|  | ||||
| from InvenTree.serializers import InvenTreeModelSerializer | ||||
| from InvenTree.serializers import InvenTreeMoneySerializer | ||||
| from InvenTree.serializers import InvenTreeAttachmentSerializerField | ||||
| @@ -28,6 +26,8 @@ from .models import PurchaseOrderAttachment, SalesOrderAttachment | ||||
| from .models import SalesOrder, SalesOrderLineItem | ||||
| from .models import SalesOrderAllocation | ||||
|  | ||||
| from common.settings import currency_code_mappings | ||||
|  | ||||
|  | ||||
| class POSerializer(InvenTreeModelSerializer): | ||||
|     """ Serializer for a PurchaseOrder object """ | ||||
| @@ -132,7 +132,7 @@ class POLineItemSerializer(InvenTreeModelSerializer): | ||||
|     destination = LocationBriefSerializer(source='get_destination', read_only=True) | ||||
|  | ||||
|     purchase_price_currency = serializers.ChoiceField( | ||||
|         choices=djmoney.settings.CURRENCY_CHOICES, | ||||
|         choices=currency_code_mappings(), | ||||
|         help_text=_('Purchase price currency'), | ||||
|     ) | ||||
|  | ||||
| @@ -348,7 +348,7 @@ class SOLineItemSerializer(InvenTreeModelSerializer): | ||||
|     sale_price_string = serializers.CharField(source='sale_price', read_only=True) | ||||
|  | ||||
|     sale_price_currency = serializers.ChoiceField( | ||||
|         choices=djmoney.settings.CURRENCY_CHOICES, | ||||
|         choices=currency_code_mappings(), | ||||
|         help_text=_('Sale price currency'), | ||||
|     ) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user