Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Display discount with 0 value

Anna Siwik2f08e5a8761d
diff --git a/saleor/order/migrations/0044_auto_20180321_1110.py b/saleor/order/migrations/0044_auto_20180326_1055.py
similarity index 84%
rename from saleor/order/migrations/0044_auto_20180321_1110.py
rename to saleor/order/migrations/0044_auto_20180326_1055.py
index 25b0de4e5c..afd12e35ae 100644
--- a/saleor/order/migrations/0044_auto_20180321_1110.py
+++ b/saleor/order/migrations/0044_auto_20180326_1055.py
@@ -1,7 +1,8 @@
-# Generated by Django 2.0.3 on 2018-03-21 16:10
+# Generated by Django 2.0.3 on 2018-03-26 15:55
from django.db import migrations, models
import django.db.models.deletion
+import django_prices.models
class Migration(migrations.Migration):
@@ -22,6 +23,11 @@ class Migration(migrations.Migration):
name='billing_address',
field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='account.Address'),
),
+ migrations.AlterField(
+ model_name='order',
+ name='discount_amount',
+ field=django_prices.models.MoneyField(currency='USD', decimal_places=2, default=0, max_digits=12),
+ ),
migrations.AlterField(
model_name='order',
name='shipping_address',
diff --git a/saleor/order/models.py b/saleor/order/models.py
index 5a342c0629..ee70f3bd77 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -66,7 +66,7 @@ class Order(models.Model):
Voucher, null=True, related_name='+', on_delete=models.SET_NULL)
discount_amount = MoneyField(
currency=settings.DEFAULT_CURRENCY, max_digits=12, decimal_places=2,
- blank=True, null=True)
+ default=0)
discount_name = models.CharField(max_length=255, default='', blank=True)
class Meta:
diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.html
index 71415a367f..11ccc2d926 100644
--- a/templates/dashboard/order/detail.html
+++ b/templates/dashboard/order/detail.html
@@ -423,11 +423,7 @@
<p>{{ order.shipping_price.gross|amount:'html' }}</p>
{% if order.is_draft or order.discount_amount %}
<p>
- {% if order.discount_amount %}
- {% discount_as_negative order.discount_amount html=True %}
- {% else %}
- {% trans "-" context "Order details empty discount" %}
- {% endif %}
+ {% discount_as_negative order.discount_amount html=True %}
</p>
{% endif %}
<p><strong>{{ order.total.gross|amount:'html' }}</strong></p>