Fix error when opening invoice update page

This commit is contained in:
Kumi 2021-11-12 19:42:32 +01:00
parent af65518b56
commit 0669e46a7a
2 changed files with 6 additions and 3 deletions

View file

@ -17,6 +17,9 @@ class Invoice(Model):
payment_method = LongCharField()
currency = ForeignKey(Currency, on_delete=PROTECT)
def display_number(self):
return self.number or self.id
class InvoiceItem(Model):
invoice = ForeignKey(Invoice, on_delete=CASCADE)
sort = PositiveIntegerField()
@ -26,4 +29,4 @@ class InvoiceItem(Model):
price = CostField()
discount = CostField()
taxable = BooleanField()
billable = ForeignKey(BaseBillable, on_delete=SET_NULL, null=True)
billable = ForeignKey(BaseBillable, on_delete=SET_NULL, null=True)

View file

@ -27,7 +27,7 @@
<div class="card-header-tab card-header-tab-animation card-header">
<div class="card-header-title">
<i class="header-icon lnr-apartment icon-gradient bg-love-kiss"> </i>
Editing {{ object.number or object.id }}
Editing {{ object.display_number }}
</div>
</div>
<div class="card-body">
@ -54,4 +54,4 @@
{% endblock %}
{% endblock %}