Require at least one of street, zipcode, city if invoice_address_required

This commit is contained in:
Mira Weller
2024-11-29 14:15:36 +01:00
parent 54d3d20d70
commit 45391b104a
+2
View File
@@ -1153,6 +1153,8 @@ 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'):
raise ValidationError({"street": _('This field is required.')})
if 'vat_id' in self.changed_data or not data.get('vat_id'):
self.instance.vat_id_validated = False