Skip to content

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

Store order total in default store currency

Artur Smęt475fcbb0d7a1
diff --git a/saleor/order/migrations/0004_order_total.py b/saleor/order/migrations/0004_order_total.py
new file mode 100644
index 0000000000..08e1375a1f
--- /dev/null
+++ b/saleor/order/migrations/0004_order_total.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django_prices.models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('order', '0003_auto_20150825_1433'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='order',
+ name='total',
+ field=django_prices.models.PriceField(decimal_places=2, currency=b'USD', max_digits=12, blank=True, null=True, verbose_name='total'),
+ ),
+ ]
diff --git a/saleor/order/models.py b/saleor/order/models.py
index f147d7f12d..2e321e7ca6 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -64,6 +64,10 @@ class Order(models.Model, ItemSet):
editable=False)
token = models.CharField(
pgettext_lazy('Order field', 'token'), max_length=36, unique=True)
+ total = PriceField(
+ pgettext_lazy('Order field', 'total'),
+ currency=settings.DEFAULT_CURRENCY, max_digits=12, decimal_places=2,
+ blank=True, null=True)
class Meta:
ordering = ('-last_status_change',)