fix a few things in the invoice list

This commit is contained in:
Thomas Steen Rasmussen 2021-08-10 21:10:31 +02:00
parent b85a1c8565
commit 288d90332b
2 changed files with 14 additions and 7 deletions

View File

@ -1,14 +1,14 @@
{% load bornhack %} {% load bornhack %}
{% if invoice_list %} {% if invoice_list %}
<table class="table table-hover"> <table class="table table-hover datatable">
<thead> <thead>
<tr> <tr>
<th>Invoice #</th> <th>Invoice #</th>
<th>Username</th> <th>Username</th>
<th>Email</th> <th>Email</th>
<th>Invoice Date</th> <th>Invoice Date</th>
<th>Paid</th>
<th>Order</th> <th>Order</th>
<th>Paid</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
@ -16,11 +16,11 @@
{% for invoice in invoice_list %} {% for invoice in invoice_list %}
<tr> <tr>
<td>{{ invoice.id }}</td> <td>{{ invoice.id }}</td>
<td>{{ invoice.user.username }}</td> <td>{{ invoice.get_order.user.username }}</td>
<td>{{ invoice.user.email }} DKK</td> <td>{{ invoice.get_order.user.email }}</td>
<td>{{ invoice.invoice_date }}</td> <td>{{ invoice.created|date }}</td>
<td>{{ invoice.paid|truefalseicon }}</td> <td>{{ invoice.get_order }}</td>
<td>{{ invoice.order }}</td> <td>{{ invoice.get_order.paid|truefalseicon }}</td>
<td> <td>
n/a n/a
</td> </td>

View File

@ -683,6 +683,13 @@ class Invoice(CreatedUpdatedModel):
def regretdate(self): def regretdate(self):
return self.created + timedelta(days=15) return self.created + timedelta(days=15)
@property
def get_order(self):
if self.order:
return self.order
else:
return self.customorder
class CoinifyAPIInvoice(CreatedUpdatedModel): class CoinifyAPIInvoice(CreatedUpdatedModel):
coinify_id = models.IntegerField(null=True) coinify_id = models.IntegerField(null=True)