Allow to use datetime components in invoice prefixes (#1529)

This commit is contained in:
Raphael Michel
2020-01-02 09:46:07 +01:00
committed by GitHub
parent fb7e859e72
commit 2a6dc22d7b
3 changed files with 10 additions and 1 deletions

View File

@@ -191,6 +191,9 @@ class Invoice(models.Model):
self.prefix = self.event.settings.invoice_numbers_prefix or (self.event.slug.upper() + '-')
if self.is_cancellation:
self.prefix = self.event.settings.invoice_numbers_prefix_cancellations or self.prefix
if '%' in self.prefix:
self.prefix = self.date.strftime(self.prefix)
if not self.invoice_no:
if self.order.testmode:
self.prefix += 'TEST-'