Add visibility on invoices
Add links to invoices on transaction tables Added invoices and has_invoice properties to transactions
This commit is contained in:
parent
7895210aea
commit
996f6a9f18
5 changed files with 19 additions and 4 deletions
|
@ -59,6 +59,14 @@ class Transaction(models.Model):
|
|||
def __str__(self):
|
||||
return f"{self.date} – {self.name}"
|
||||
|
||||
@property
|
||||
def invoices(self):
|
||||
return Invoice.objects.filter(transaction=self)
|
||||
|
||||
@property
|
||||
def has_invoice(self):
|
||||
return self.invoices.count() > 0
|
||||
|
||||
class Meta:
|
||||
ordering = ["-date"]
|
||||
verbose_name = _("Transaction")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue