Skip to content

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

Add status to fulfillemnt

Anna Siwikac6db2f10d7d
diff --git a/saleor/order/__init__.py b/saleor/order/__init__.py
index 6bb06551b3..d85f71549d 100644
--- a/saleor/order/__init__.py
+++ b/saleor/order/__init__.py
@@ -23,3 +23,12 @@ class OrderStatus:
'order status', 'Partially fulfilled')),
(FULFILLED, pgettext_lazy('order status', 'Fulfilled')),
(CANCELED, pgettext_lazy('order status', 'Canceled'))]
+
+
+class FulfillmentStatus:
+ FULFILLED = 'fulfilled'
+ CANCELED = 'canceled'
+
+ CHOICES = [
+ (FULFILLED, pgettext_lazy('order status', 'Fulfilled')),
+ (CANCELED, pgettext_lazy('order status', 'Canceled'))]
diff --git a/saleor/order/migrations/0035_auto_20180222_0318.py b/saleor/order/migrations/0035_auto_20180222_0345.py
similarity index 83%
rename from saleor/order/migrations/0035_auto_20180222_0318.py
rename to saleor/order/migrations/0035_auto_20180222_0345.py
index 2680150e7b..1477deb4b8 100644
--- a/saleor/order/migrations/0035_auto_20180222_0318.py
+++ b/saleor/order/migrations/0035_auto_20180222_0345.py
@@ -1,4 +1,4 @@
-# Generated by Django 2.0.2 on 2018-02-22 09:18
+# Generated by Django 2.0.2 on 2018-02-22 09:45
from django.db import migrations, models
import django.db.models.deletion
@@ -24,6 +24,11 @@ class Migration(migrations.Migration):
name='fulfillment_order',
field=models.PositiveIntegerField(editable=False, null=True),
),
+ migrations.AddField(
+ model_name='fulfillment',
+ name='status',
+ field=models.CharField(choices=[('fulfilled', 'Fulfilled'), ('canceled', 'Canceled')], default='fulfilled', max_length=32),
+ ),
migrations.AddField(
model_name='order',
name='shipping_method_name',
diff --git a/saleor/order/models.py b/saleor/order/models.py
index 8d9f383fd2..ab19ffd80b 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -13,7 +13,7 @@ from payments import PaymentStatus, PurchasedItem
from payments.models import BasePayment
from prices import Money, TaxedMoney
-from . import OrderStatus
+from . import FulfillmentStatus, OrderStatus
from ..account.models import Address
from ..core.utils import ZERO_TAXED_MONEY, build_absolute_uri
from ..discount.models import Voucher
@@ -203,6 +203,9 @@ class Fulfillment(models.Model):
order = models.ForeignKey(
Order, related_name='fulfillments', editable=False,
on_delete=models.CASCADE)
+ status = models.CharField(
+ max_length=32, default=FulfillmentStatus.FULFILLED,
+ choices=FulfillmentStatus.CHOICES)
tracking_number = models.CharField(max_length=255, default='', blank=True)
shipping_date = models.DateTimeField(default=now, editable=False)
diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.html
index 3de454b37c..5d51e1b827 100644
--- a/templates/dashboard/order/detail.html
+++ b/templates/dashboard/order/detail.html
@@ -411,6 +411,7 @@
Fulfillment #{{ fulfillment }}
{% endblocktrans %}
</h5>
+ {% render_status fulfillment.status fulfillment.get_status_display %}
</div>
<div class="data-table-container">
<table class="bordered highlight responsive data-table">