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:
|
||||
# The order was created with the specified context.
|
||||
CREATED = 'CREATED'
|
||||
|
||||
@ -24,6 +24,7 @@ from . import (
|
||||
VoucherType,
|
||||
TransactionStatus,
|
||||
OrderStatus,
|
||||
ShippingStatus,
|
||||
ShippingProvider,
|
||||
ShippingContainer
|
||||
)
|
||||
@ -397,6 +398,15 @@ class Order(models.Model):
|
||||
|
||||
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):
|
||||
for line in self.lines.all():
|
||||
line.minus_stock()
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
<th>Order No.</th>
|
||||
<th>Date</th>
|
||||
<th>Customer</th>
|
||||
<th>Status</th>
|
||||
<th>Fulfillment</th>
|
||||
<th>Shipping</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -18,6 +19,17 @@
|
||||
<span class="status-dot status-{{order.status}}"></span> {{order.get_status_display}}
|
||||
</div>
|
||||
</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>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
@ -109,7 +109,7 @@
|
||||
</tr>
|
||||
{% if order.coupon_amount > 0 %}
|
||||
<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>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
{% for category in category_list %}
|
||||
<li><a class="nav__link" href="{% url 'storefront:category-detail' category.pk %}">{{ category }}</a></li>
|
||||
{% 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:reviews' %}">Reviews</a></li>
|
||||
<li><a class="nav__link" href="{% url 'storefront:about' %}">About</a></li>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user