From 61cb2e15cff7c2a5013cae258293f51bed3faa29 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 29 Nov 2024 20:08:36 +0100 Subject: [PATCH] Fix validation crash of InvoiceNameForm --- src/pretix/base/forms/questions.py | 3 ++- src/pretix/presale/forms/checkout.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pretix/base/forms/questions.py b/src/pretix/base/forms/questions.py index e7402d8cb..dea30d675 100644 --- a/src/pretix/base/forms/questions.py +++ b/src/pretix/base/forms/questions.py @@ -1143,6 +1143,7 @@ class BaseInvoiceAddressForm(forms.ModelForm): validate_address # local import to prevent impact on startup time data = self.cleaned_data + if not data.get('is_business'): data['company'] = '' data['vat_id'] = '' @@ -1153,7 +1154,7 @@ class BaseInvoiceAddressForm(forms.ModelForm): raise ValidationError({"company": _('You need to provide a company name.')}) if not data.get('is_business') and not data.get('name_parts'): raise ValidationError(_('You need to provide your name.')) - if not data.get('street') and not data.get('zipcode') and not data.get('city'): + if 'street' in self.fields and not data.get('street') and not data.get('zipcode') and not data.get('city'): raise ValidationError({"street": _('This field is required.')}) if 'vat_id' in self.changed_data or not data.get('vat_id'): diff --git a/src/pretix/presale/forms/checkout.py b/src/pretix/presale/forms/checkout.py index d890df288..e786d1c92 100644 --- a/src/pretix/presale/forms/checkout.py +++ b/src/pretix/presale/forms/checkout.py @@ -133,6 +133,7 @@ class InvoiceAddressForm(BaseInvoiceAddressForm): class InvoiceNameForm(InvoiceAddressForm): + address_validation = False def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)