Fix invoice delete

This commit is contained in:
Edgar P. Burkhart 2023-01-01 09:18:01 +01:00
parent 01dcd561d6
commit d767ef1a7a
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 9 additions and 3 deletions

View file

@ -300,7 +300,7 @@ class Invoice(CustomModel):
return str(self.name)
def delete(self, *args, **kwargs):
self.file.delete(missing_ok=True)
self.file.delete()
super().delete(*args, **kwargs)
def get_absolute_url(self):

View file

@ -247,8 +247,14 @@ class InvoiceDeleteView(NummiDeleteView):
return reverse_lazy("transaction", kwargs={"pk": self.object.transaction.pk})
def get_queryset(self):
return super.get_queryset().filter(
transaction=get_object_or_404(Transaction, pk=self.kwargs["transaction_pk"])
return (
super()
.get_queryset()
.filter(
transaction=get_object_or_404(
Transaction, pk=self.kwargs["transaction_pk"]
)
)
)