Fix display error for quote numbers in edit view

This commit is contained in:
Kumi 2021-11-13 17:17:18 +01:00
parent 2feb3e637b
commit 8c42b386f3
2 changed files with 7 additions and 3 deletions

View file

@ -15,6 +15,10 @@ class Quote(Model):
expiry = DateField()
currency = ForeignKey(Currency, on_delete=PROTECT)
@property
def display_number(self):
return self.number or self.id
class QuoteItem(Model):
invoice = ForeignKey(Quote, on_delete=CASCADE)
sort = PositiveIntegerField()
@ -23,4 +27,4 @@ class QuoteItem(Model):
price = CostField()
discount = CostField()
taxable = BooleanField()
service = ForeignKey(Service, on_delete=SET_NULL, null=True)
service = ForeignKey(Service, 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 %}