Skip to content

Commit

Permalink
Merge pull request #268 from TreyWW/fix/264
Browse files Browse the repository at this point in the history
fix: Editing invoice fixed (#264)
  • Loading branch information
TreyWW authored Apr 1, 2024
2 parents c81329b + d96ee84 commit 7c18002
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/views/core/invoices/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def edit_invoice(request: HttpRequest, invoice_id):
client_to_id = request.POST.get("selected_client")
try:
client_to_obj = Client.objects.get(id=client_to_id, user=request.user)
except Client.DoesNotExist:
except (Client.DoesNotExist, ValueError):
client_to_obj = None

if client_to_obj:
Expand Down Expand Up @@ -139,8 +139,9 @@ def edit_invoice(request: HttpRequest, invoice_id):

invoice.save()

messages.success(request, "Invoice edited")

if request.htmx:
messages.success(request, "Invoice edited")
return render(request, "base/toasts.html")

return invoice_edit_page_get(request, invoice_id)
Expand Down

0 comments on commit 7c18002

Please sign in to comment.