Refs #131 -- Allow to regenerate an invoice

This commit is contained in:
Raphael Michel
2016-08-05 11:26:13 +02:00
parent a61792ed4e
commit a22262aa30
5 changed files with 91 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ from decimal import Decimal
from django.db import DatabaseError, models
from django.db.models import Max
from django.utils.functional import cached_property
def invoice_filename(instance, filename: str) -> str:
@@ -80,6 +81,10 @@ class Invoice(models.Model):
"""
return '%s-%05d' % (self.event.slug.upper(), self.invoice_no)
@cached_property
def canceled(self):
return self.refered.filter(is_cancellation=True).exists()
class Meta:
unique_together = ('event', 'invoice_no')