Fix update_sum left in transaction models

This commit is contained in:
Edgar P. Burkhart 2025-01-03 19:16:03 +01:00
parent 0c5ba6899b
commit ec5c0e2fef
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 2 additions and 13 deletions
nummi
statement/templates/statement/forms/widgets
transaction

View file

@ -7,6 +7,5 @@
{% endif %}
{% endfor %}
{% endfor %}
{% else %}
{% include "django/forms/widgets/select.html" %}
{% endif %}
{% include "django/forms/widgets/select.html" %}

View file

@ -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):

View file

@ -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}"