From b1daa21e2c2c9eafd7afb104f760df10d5928344 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 1 May 2024 14:26:40 -0400 Subject: [PATCH] membershipworks: Reject event invoice form if an invoice already exists --- membershipworks/forms.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/membershipworks/forms.py b/membershipworks/forms.py index 0eaf6ae..9432c0c 100644 --- a/membershipworks/forms.py +++ b/membershipworks/forms.py @@ -22,6 +22,9 @@ class EventInvoiceForm(forms.Form): super().__init__(*args, **kwargs) def clean(self): + if hasattr(self.event, "invoice") is not None: + raise forms.ValidationError("An invoice was already created!") + if self.event.total_due_to_instructor is None: raise forms.ValidationError( "Event missing required information to generate invoice"