diff --git a/nummi/statement/templates/statement/forms/widgets/statement.html b/nummi/statement/templates/statement/forms/widgets/statement.html index 0689a39..aad0402 100644 --- a/nummi/statement/templates/statement/forms/widgets/statement.html +++ b/nummi/statement/templates/statement/forms/widgets/statement.html @@ -7,6 +7,5 @@ {% endif %} {% endfor %} {% endfor %} -{% else %} - {% include "django/forms/widgets/select.html" %} {% endif %} +{% include "django/forms/widgets/select.html" %} diff --git a/nummi/transaction/forms.py b/nummi/transaction/forms.py index ffecd63..5583c84 100644 --- a/nummi/transaction/forms.py +++ b/nummi/transaction/forms.py @@ -102,6 +102,7 @@ class TransactionForm(NummiForm): if _disable_statement: self.fields["statement"].disabled = True + self.fields["statement"].widget.attrs["hidden"] = True class InvoiceForm(NummiForm): diff --git a/nummi/transaction/models.py b/nummi/transaction/models.py index adc78c0..37fc1d5 100644 --- a/nummi/transaction/models.py +++ b/nummi/transaction/models.py @@ -44,17 +44,6 @@ class Transaction(UserModel): verbose_name=_("Statement"), ) - def save(self, *args, **kwargs): - if Transaction.objects.filter(pk=self.pk): - prev_self = Transaction.objects.get(pk=self.pk) - else: - prev_self = None - super().save(*args, **kwargs) - if prev_self is not None and prev_self.statement: - prev_self.statement.update_sum() - if self.statement: - self.statement.update_sum() - def __str__(self): return f"{self.name}"