Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix invalid default values for decimal fields (#11487)
Iga Karbowiakee2b248d8076
diff --git a/saleor/discount/models.py b/saleor/discount/models.pyindex 182a2d3421..895f442526 100644--- a/saleor/discount/models.py+++ b/saleor/discount/models.py@@ -328,7 +328,7 @@ class SaleChannelListing(models.Model):discount_value = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS,decimal_places=settings.DEFAULT_DECIMAL_PLACES,- default=0,+ default=Decimal("0.0"),)currency = models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH,@@ -380,13 +380,13 @@ class OrderDiscount(models.Model):value = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS,decimal_places=settings.DEFAULT_DECIMAL_PLACES,- default=0,+ default=Decimal("0.0"),)amount_value = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS,decimal_places=settings.DEFAULT_DECIMAL_PLACES,- default=0,+ default=Decimal("0.0"),)amount = MoneyField(amount_field="amount_value", currency_field="currency")currency = models.CharField(diff --git a/saleor/order/models.py b/saleor/order/models.pyindex 6658626d7d..aa2086ca05 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -529,7 +529,7 @@ class OrderLine(ModelWithMetadata):unit_discount_value = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS,decimal_places=settings.DEFAULT_DECIMAL_PLACES,- default=0,+ default=Decimal("0.0"),)unit_price_net = MoneyField(amount_field="unit_price_net_amount", currency_field="currency"diff --git a/saleor/shipping/models.py b/saleor/shipping/models.pyindex 109b976637..158f80e868 100644--- a/saleor/shipping/models.py+++ b/saleor/shipping/models.py@@ -1,3 +1,4 @@+from decimal import Decimalfrom typing import TYPE_CHECKING, List, Unionfrom django.conf import settings@@ -264,7 +265,7 @@ class ShippingMethodChannelListing(models.Model):minimum_order_price_amount = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS,decimal_places=settings.DEFAULT_DECIMAL_PLACES,- default=0,+ default=Decimal("0.0"),blank=True,null=True,)@@ -287,7 +288,7 @@ class ShippingMethodChannelListing(models.Model):price_amount = models.DecimalField(max_digits=settings.DEFAULT_MAX_DIGITS,decimal_places=settings.DEFAULT_DECIMAL_PLACES,- default=0,+ default=Decimal("0.0"),)def get_total(self):