From ab84a7ff830bfdf8df2235ec11f5a83e05533a10 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 5 Jun 2023 23:24:42 +0200 Subject: [PATCH] make currency choices independend --- InvenTree/company/migrations/0025_auto_20201110_1001.py | 3 ++- InvenTree/order/migrations/0038_auto_20201112_1737.py | 3 ++- InvenTree/order/migrations/0045_auto_20210504_1946.py | 3 ++- InvenTree/part/migrations/0055_auto_20201110_1001.py | 3 ++- InvenTree/part/migrations/0067_partinternalpricebreak.py | 3 ++- InvenTree/part/migrations/0089_auto_20221112_0128.py | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/InvenTree/company/migrations/0025_auto_20201110_1001.py b/InvenTree/company/migrations/0025_auto_20201110_1001.py index 0fd62c0a23..1be20713d9 100644 --- a/InvenTree/company/migrations/0025_auto_20201110_1001.py +++ b/InvenTree/company/migrations/0025_auto_20201110_1001.py @@ -2,6 +2,7 @@ from django.db import migrations, connection import djmoney.models.fields +import common.models class Migration(migrations.Migration): @@ -19,6 +20,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='supplierpricebreak', name='price_currency', - field=djmoney.models.fields.CurrencyField(choices=[('AUD', 'Australian Dollar'), ('CAD', 'Canadian Dollar'), ('EUR', 'Euro'), ('NZD', 'New Zealand Dollar'), ('GBP', 'Pound Sterling'), ('USD', 'US Dollar'), ('JPY', 'Yen')], default='USD', editable=False, max_length=3), + field=djmoney.models.fields.CurrencyField(choices=common.settings.currency_code_mappings, default='USD', editable=False, max_length=3), ), ] diff --git a/InvenTree/order/migrations/0038_auto_20201112_1737.py b/InvenTree/order/migrations/0038_auto_20201112_1737.py index 0d563c80d4..76a7d1eaa2 100644 --- a/InvenTree/order/migrations/0038_auto_20201112_1737.py +++ b/InvenTree/order/migrations/0038_auto_20201112_1737.py @@ -2,6 +2,7 @@ from django.db import migrations import djmoney.models.fields +import common.models class Migration(migrations.Migration): @@ -19,6 +20,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='purchaseorderlineitem', name='purchase_price_currency', - field=djmoney.models.fields.CurrencyField(choices=[('AUD', 'Australian Dollar'), ('CAD', 'Canadian Dollar'), ('EUR', 'Euro'), ('NZD', 'New Zealand Dollar'), ('GBP', 'Pound Sterling'), ('USD', 'US Dollar'), ('JPY', 'Yen')], default='USD', editable=False, max_length=3), + field=djmoney.models.fields.CurrencyField(choices=common.settings.currency_code_mappings, default='USD', editable=False, max_length=3), ), ] diff --git a/InvenTree/order/migrations/0045_auto_20210504_1946.py b/InvenTree/order/migrations/0045_auto_20210504_1946.py index a8d9469dc7..5d6b7e0661 100644 --- a/InvenTree/order/migrations/0045_auto_20210504_1946.py +++ b/InvenTree/order/migrations/0045_auto_20210504_1946.py @@ -1,6 +1,7 @@ # Generated by Django 3.2 on 2021-05-04 19:46 from django.db import migrations +import common.models import djmoney.models.fields @@ -19,6 +20,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='salesorderlineitem', name='sale_price_currency', - field=djmoney.models.fields.CurrencyField(choices=[('AUD', 'Australian Dollar'), ('GBP', 'British Pound'), ('CAD', 'Canadian Dollar'), ('EUR', 'Euro'), ('JPY', 'Japanese Yen'), ('NZD', 'New Zealand Dollar'), ('USD', 'US Dollar')], default='USD', editable=False, max_length=3), + field=djmoney.models.fields.CurrencyField(choices=common.settings.currency_code_mappings, default='USD', editable=False, max_length=3), ), ] diff --git a/InvenTree/part/migrations/0055_auto_20201110_1001.py b/InvenTree/part/migrations/0055_auto_20201110_1001.py index e9649c985e..ed83b83919 100644 --- a/InvenTree/part/migrations/0055_auto_20201110_1001.py +++ b/InvenTree/part/migrations/0055_auto_20201110_1001.py @@ -2,6 +2,7 @@ from django.db import migrations import djmoney.models.fields +import common.models class Migration(migrations.Migration): @@ -19,6 +20,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='partsellpricebreak', name='price_currency', - field=djmoney.models.fields.CurrencyField(choices=[('AUD', 'Australian Dollar'), ('CAD', 'Canadian Dollar'), ('EUR', 'Euro'), ('NZD', 'New Zealand Dollar'), ('GBP', 'Pound Sterling'), ('USD', 'US Dollar'), ('JPY', 'Yen')], default='USD', editable=False, max_length=3), + field=djmoney.models.fields.CurrencyField(choices=common.settings.currency_code_mappings, default='USD', editable=False, max_length=3), ), ] diff --git a/InvenTree/part/migrations/0067_partinternalpricebreak.py b/InvenTree/part/migrations/0067_partinternalpricebreak.py index f1b16fe87c..f47ab8b9d0 100644 --- a/InvenTree/part/migrations/0067_partinternalpricebreak.py +++ b/InvenTree/part/migrations/0067_partinternalpricebreak.py @@ -2,6 +2,7 @@ import InvenTree.fields import django.core.validators +import common.models from django.db import migrations, models import django.db.models.deletion import djmoney.models.fields @@ -19,7 +20,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('quantity', InvenTree.fields.RoundingDecimalField(decimal_places=5, default=1, help_text='Price break quantity', max_digits=15, validators=[django.core.validators.MinValueValidator(1)], verbose_name='Quantity')), - ('price_currency', djmoney.models.fields.CurrencyField(choices=[('AUD', 'Australian Dollar'), ('CAD', 'Canadian Dollar'), ('EUR', 'Euro'), ('NZD', 'New Zealand Dollar'), ('GBP', 'Pound Sterling'), ('USD', 'US Dollar'), ('JPY', 'Yen')], default='USD', editable=False, max_length=3)), + ('price_currency', djmoney.models.fields.CurrencyField(choices=common.settings.currency_code_mappings, default='USD', editable=False, max_length=3)), ('price', djmoney.models.fields.MoneyField(decimal_places=4, default_currency='USD', help_text='Unit price at specified quantity', max_digits=19, null=True, verbose_name='Price')), ('part', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='internalpricebreaks', to='part.part', verbose_name='Part')), ], diff --git a/InvenTree/part/migrations/0089_auto_20221112_0128.py b/InvenTree/part/migrations/0089_auto_20221112_0128.py index ed84289568..b9261cff54 100644 --- a/InvenTree/part/migrations/0089_auto_20221112_0128.py +++ b/InvenTree/part/migrations/0089_auto_20221112_0128.py @@ -2,6 +2,7 @@ import InvenTree.fields import common.settings +import common.models import django.core.validators from django.db import migrations, models import django.db.models.deletion @@ -35,7 +36,7 @@ class Migration(migrations.Migration): name='PartPricing', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('currency', models.CharField(choices=[('AUD', 'Australian Dollar'), ('CAD', 'Canadian Dollar'), ('CNY', 'Chinese Yuan'), ('EUR', 'Euro'), ('GBP', 'British Pound'), ('JPY', 'Japanese Yen'), ('NZD', 'New Zealand Dollar'), ('USD', 'US Dollar')], default=common.settings.currency_code_default, help_text='Currency used to cache pricing calculations', max_length=10, verbose_name='Currency')), + ('currency', models.CharField(choices=common.settings.currency_code_mappings, default=common.settings.currency_code_default, help_text='Currency used to cache pricing calculations', max_length=10, verbose_name='Currency')), ('updated', models.DateTimeField(auto_now=True, help_text='Timestamp of last pricing update', verbose_name='Updated')), ('scheduled_for_update', models.BooleanField(default=False)), ('bom_cost_min_currency', djmoney.models.fields.CurrencyField(choices=[], default='', editable=False, max_length=3)),