Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use "settings.DEFAULT_CURRENCY" in "minimal_variant_price" migration
Mateusz Dereniowski521934c2fa23
diff --git a/saleor/product/migrations/0105_product_minimal_variant_price.py b/saleor/product/migrations/0105_product_minimal_variant_price.pyindex 855bc80f18..e2ed61efcd 100644--- a/saleor/product/migrations/0105_product_minimal_variant_price.py+++ b/saleor/product/migrations/0105_product_minimal_variant_price.py@@ -1,6 +1,7 @@# Generated by Django 2.2.1 on 2019-06-10 11:23import django_prices.models+from django.conf import settingsfrom django.db import migrations@@ -8,6 +9,10 @@ def populate_product_minimal_variant_price(apps, schema_editor):Product = apps.get_model("product", "Product")for product in Product.objects.iterator():# Set the "minimal variant price" to the default product's price+ # We don't calculate the "minimal variant price" here because the logic+ # depends on models' methods and we would have to copy all the code into+ # this migration. Instead we should manually run the management command:+ # - "update_all_products_minimal_variant_prices"product.minimal_variant_price = product.priceproduct.save(update_fields=["minimal_variant_price"])@@ -21,7 +26,10 @@ class Migration(migrations.Migration):model_name="product",name="minimal_variant_price",field=django_prices.models.MoneyField(- currency="USD", decimal_places=2, max_digits=12, null=True+ currency=settings.DEFAULT_CURRENCY,+ decimal_places=2,+ max_digits=12,+ null=True,),),migrations.RunPython(@@ -32,7 +40,7 @@ class Migration(migrations.Migration):model_name="product",name="minimal_variant_price",field=django_prices.models.MoneyField(- currency="USD", decimal_places=2, max_digits=12+ currency=settings.DEFAULT_CURRENCY, decimal_places=2, max_digits=12),),]