diff --git a/nummi/main/models.py b/nummi/main/models.py index 664cc09..7238625 100644 --- a/nummi/main/models.py +++ b/nummi/main/models.py @@ -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") diff --git a/nummi/main/static/main/css/table.css b/nummi/main/static/main/css/table.css index e649e9a..bfed8a7 100644 --- a/nummi/main/static/main/css/table.css +++ b/nummi/main/static/main/css/table.css @@ -11,6 +11,7 @@ .table.col4 {grid-template-columns: repeat(4, auto)} .table.col5 {grid-template-columns: repeat(5, auto)} .table.col6 {grid-template-columns: repeat(6, auto)} +.table.col1-6 {grid-template-columns: min-content repeat(6, auto)} .table > div { display: contents; diff --git a/nummi/main/templates/main/tag/transaction_table.html b/nummi/main/templates/main/tag/transaction_table.html index d4a0622..b27e993 100644 --- a/nummi/main/templates/main/tag/transaction_table.html +++ b/nummi/main/templates/main/tag/transaction_table.html @@ -1,8 +1,9 @@ {% load main_extras %} {% load i18n %} -