Fix invoice delete
This commit is contained in:
parent
01dcd561d6
commit
d767ef1a7a
2 changed files with 9 additions and 3 deletions
|
@ -300,7 +300,7 @@ class Invoice(CustomModel):
|
||||||
return str(self.name)
|
return str(self.name)
|
||||||
|
|
||||||
def delete(self, *args, **kwargs):
|
def delete(self, *args, **kwargs):
|
||||||
self.file.delete(missing_ok=True)
|
self.file.delete()
|
||||||
super().delete(*args, **kwargs)
|
super().delete(*args, **kwargs)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
|
|
|
@ -247,8 +247,14 @@ class InvoiceDeleteView(NummiDeleteView):
|
||||||
return reverse_lazy("transaction", kwargs={"pk": self.object.transaction.pk})
|
return reverse_lazy("transaction", kwargs={"pk": self.object.transaction.pk})
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return super.get_queryset().filter(
|
return (
|
||||||
transaction=get_object_or_404(Transaction, pk=self.kwargs["transaction_pk"])
|
super()
|
||||||
|
.get_queryset()
|
||||||
|
.filter(
|
||||||
|
transaction=get_object_or_404(
|
||||||
|
Transaction, pk=self.kwargs["transaction_pk"]
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue