Fix error when marking an expired order as paid

This commit is contained in:
Raphael Michel
2018-12-07 11:04:41 +01:00
parent 6293ad34d4
commit 85289fe0d1
3 changed files with 6 additions and 2 deletions

View File

@@ -208,7 +208,7 @@ class Order(LockModel, LoggedModel):
def pending_sum(self):
total = self.total
if self.status in (Order.STATUS_REFUNDED, Order.STATUS_CANCELED):
total = 0
total = Decimal('0.00')
payment_sum = self.payments.filter(
state__in=(OrderPayment.PAYMENT_STATE_CONFIRMED, OrderPayment.PAYMENT_STATE_REFUNDED)
).aggregate(s=Sum('amount'))['s'] or Decimal('0.00')