membershipworks: Reject event invoice form if an invoice already exists
Some checks failed
Ruff / ruff (push) Successful in 29s
Test / test (push) Failing after 4m56s

This commit is contained in:
Adam Goldsmith 2024-05-01 14:26:40 -04:00
parent 0f1640a5d6
commit b1daa21e2c

View File

@ -22,6 +22,9 @@ class EventInvoiceForm(forms.Form):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
def clean(self): 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: if self.event.total_due_to_instructor is None:
raise forms.ValidationError( raise forms.ValidationError(
"Event missing required information to generate invoice" "Event missing required information to generate invoice"