Update __str__ functions

This commit is contained in:
Edgar P. Burkhart 2023-04-20 09:23:30 +02:00
parent 4792388ccd
commit 492e6e77d1
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -153,7 +153,7 @@ class Snapshot(AccountModel):
def __str__(self):
desc = _("%(date)s statement") % {"date": self.date}
if hasattr(self, "account"):
return f"{desc} {self.account}"
return f"{desc} {self.account}"
return desc
def save(self, *args, **kwargs):
@ -243,7 +243,7 @@ class Transaction(NummiModel):
self.snapshot.update_sum()
def __str__(self):
return f"{self.date} {self.name}"
return f"{self.name}"
def get_absolute_url(self):
return reverse("transaction", kwargs={"pk": self.pk})
@ -288,8 +288,6 @@ class Invoice(NummiModel):
super().save(*args, **kwargs)
def __str__(self):
if hasattr(self, "transaction"):
return str(format_lazy("{} {}", self.name, self.transaction.name))
return str(self.name)
def delete(self, *args, **kwargs):