only mark as refunded if order is paid

This commit is contained in:
Thomas Steen Rasmussen 2016-06-19 08:38:43 +02:00
parent 863b0bc175
commit ea36b68493

View file

@ -144,6 +144,9 @@ class Order(CreatedUpdatedModel):
self.save()
def mark_as_refunded(self):
if not self.paid:
messages.error(self.request, "Order %s is not paid so cannot mark as refunded!" % self.pk)
else:
self.refunded=True
### delete any tickets related to this order
self.tickets.all().delete()