Merge branch 'release/3.0.18'
This commit is contained in:
commit
8d7646d289
@ -49,6 +49,18 @@ class OrderStatus:
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class ShippingStatus:
|
||||||
|
NOT_SHIPPED = 'Not shipped'
|
||||||
|
PARTIALLY_SHIPPED = 'Partially shipped'
|
||||||
|
SHIPPED = 'Shipped'
|
||||||
|
|
||||||
|
CHOICES = [
|
||||||
|
(NOT_SHIPPED, 'Not shipped'),
|
||||||
|
(PARTIALLY_SHIPPED, 'Partially shipped'),
|
||||||
|
(SHIPPED, 'Shipped'),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class TransactionStatus:
|
class TransactionStatus:
|
||||||
# The order was created with the specified context.
|
# The order was created with the specified context.
|
||||||
CREATED = 'CREATED'
|
CREATED = 'CREATED'
|
||||||
|
|||||||
@ -24,6 +24,7 @@ from . import (
|
|||||||
VoucherType,
|
VoucherType,
|
||||||
TransactionStatus,
|
TransactionStatus,
|
||||||
OrderStatus,
|
OrderStatus,
|
||||||
|
ShippingStatus,
|
||||||
ShippingProvider,
|
ShippingProvider,
|
||||||
ShippingContainer
|
ShippingContainer
|
||||||
)
|
)
|
||||||
@ -397,6 +398,15 @@ class Order(models.Model):
|
|||||||
|
|
||||||
objects = OrderManager()
|
objects = OrderManager()
|
||||||
|
|
||||||
|
def get_shipping_status(self):
|
||||||
|
has_tracking = self.tracking_numbers.count() > 0
|
||||||
|
if has_tracking and self.status == OrderStatus.FULFILLED:
|
||||||
|
return ShippingStatus.SHIPPED
|
||||||
|
elif has_tracking and self.status == OrderStatus.PARTIALLY_FULFILLED:
|
||||||
|
return ShippingStatus.PARTIALLY_SHIPPED
|
||||||
|
|
||||||
|
return ShippingStatus.NOT_SHIPPED
|
||||||
|
|
||||||
def minus_stock(self):
|
def minus_stock(self):
|
||||||
for line in self.lines.all():
|
for line in self.lines.all():
|
||||||
line.minus_stock()
|
line.minus_stock()
|
||||||
|
|||||||
@ -3,7 +3,8 @@
|
|||||||
<th>Order No.</th>
|
<th>Order No.</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Customer</th>
|
<th>Customer</th>
|
||||||
<th>Status</th>
|
<th>Fulfillment</th>
|
||||||
|
<th>Shipping</th>
|
||||||
<th>Total</th>
|
<th>Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -18,6 +19,17 @@
|
|||||||
<span class="status-dot status-{{order.status}}"></span> {{order.get_status_display}}
|
<span class="status-dot status-{{order.status}}"></span> {{order.get_status_display}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="status-display">
|
||||||
|
{% if order.get_shipping_status == "Shipped" %}
|
||||||
|
<span class="status-dot status-success"></span> {{ order.get_shipping_status }}
|
||||||
|
{% elif order.get_shipping_status == "Partially shipped" %}
|
||||||
|
<span class="status-dot status-warning"></span> {{ order.get_shipping_status }}
|
||||||
|
{% else %}
|
||||||
|
<span class="status-dot status-info"></span> {{ order.get_shipping_status }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
<td>${{order.total_amount}}</td>
|
<td>${{order.total_amount}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@ -109,7 +109,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% if order.coupon_amount > 0 %}
|
{% if order.coupon_amount > 0 %}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="4">Discount:</th>
|
<th colspan="4">Discount {% if order.coupon %}<a href="{% url 'dashboard:coupon-detail' order.coupon.pk %}">{{ order.coupon }} ↗</a>{% endif %}:</th>
|
||||||
<td>${{ order.coupon_amount }}</td>
|
<td>${{ order.coupon_amount }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -54,7 +54,7 @@
|
|||||||
{% for category in category_list %}
|
{% for category in category_list %}
|
||||||
<li><a class="nav__link" href="{% url 'storefront:category-detail' category.pk %}">{{ category }}</a></li>
|
<li><a class="nav__link" href="{% url 'storefront:category-detail' category.pk %}">{{ category }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<li><a class="nav__link" href="{% url 'storefront:subscription-form' %}">Subscriptions</a></li>
|
<li><a class="nav__link" href="{% url 'storefront:subscription-form' %}">Subscribe</a></li>
|
||||||
<li><a class="nav__link" href="{% url 'storefront:fair-trade' %}">Fair trade</a></li>
|
<li><a class="nav__link" href="{% url 'storefront:fair-trade' %}">Fair trade</a></li>
|
||||||
<li><a class="nav__link" href="{% url 'storefront:reviews' %}">Reviews</a></li>
|
<li><a class="nav__link" href="{% url 'storefront:reviews' %}">Reviews</a></li>
|
||||||
<li><a class="nav__link" href="{% url 'storefront:about' %}">About</a></li>
|
<li><a class="nav__link" href="{% url 'storefront:about' %}">About</a></li>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user