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,10 +144,13 @@ class Order(CreatedUpdatedModel):
self.save()
def mark_as_refunded(self):
self.refunded=True
### delete any tickets related to this order
self.tickets.all().delete()
self.save()
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()
self.save()
def is_not_handed_out(self):
if self.orderproductrelation_set.filter(handed_out=True).count() == 0: