Fix all-optional in address-form for resellers (#4672)

This commit is contained in:
Richard Schreiber
2024-12-02 09:46:33 +01:00
committed by GitHub
parent 61cb2e15cf
commit d1989c3cd3

View File

@@ -1154,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 'street' in self.fields and not data.get('street') and not data.get('zipcode') and not data.get('city'):
if not self.all_optional and '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'):