diff --git a/src/pretix/base/forms/questions.py b/src/pretix/base/forms/questions.py index 3b4533a42b..5912af3464 100644 --- a/src/pretix/base/forms/questions.py +++ b/src/pretix/base/forms/questions.py @@ -27,7 +27,7 @@ from pretix.base.forms.widgets import ( TimePickerWidget, UploadedFileWidget, ) from pretix.base.models import InvoiceAddress, Question, QuestionOption -from pretix.base.models.tax import EU_COUNTRIES +from pretix.base.models.tax import EU_COUNTRIES, cc_to_vat_prefix from pretix.base.settings import ( COUNTRIES_WITH_STATE_IN_ADDRESS, PERSON_NAME_SCHEMES, PERSON_NAME_TITLE_GROUPS, @@ -491,7 +491,7 @@ class BaseInvoiceAddressForm(forms.ModelForm): if self.validate_vat_id and self.instance.vat_id_validated and 'vat_id' not in self.changed_data: pass elif self.validate_vat_id and data.get('is_business') and data.get('country') in EU_COUNTRIES and data.get('vat_id'): - if data.get('vat_id')[:2] != str(data.get('country')): + if data.get('vat_id')[:2] != cc_to_vat_prefix(str(data.get('country'))): raise ValidationError(_('Your VAT ID does not match the selected country.')) try: result = vat_moss.id.validate(data.get('vat_id')) diff --git a/src/pretix/base/models/tax.py b/src/pretix/base/models/tax.py index 303873dab1..5651ee6375 100644 --- a/src/pretix/base/models/tax.py +++ b/src/pretix/base/models/tax.py @@ -85,6 +85,12 @@ EU_CURRENCIES = { } +def cc_to_vat_prefix(country_code): + if country_code == 'GR': + return 'EL' + return country_code + + class TaxRule(LoggedModel): event = models.ForeignKey('Event', related_name='tax_rules', on_delete=models.CASCADE) name = I18nCharField( diff --git a/src/pretix/control/views/orders.py b/src/pretix/control/views/orders.py index 7c38ec6a59..8a612895f6 100644 --- a/src/pretix/control/views/orders.py +++ b/src/pretix/control/views/orders.py @@ -41,7 +41,7 @@ from pretix.base.models import ( from pretix.base.models.orders import ( OrderFee, OrderPayment, OrderPosition, OrderRefund, ) -from pretix.base.models.tax import EU_COUNTRIES +from pretix.base.models.tax import EU_COUNTRIES, cc_to_vat_prefix from pretix.base.payment import PaymentException from pretix.base.services import tickets from pretix.base.services.export import export @@ -983,7 +983,7 @@ class OrderCheckVATID(OrderView): 'specified.')) return redirect(self.get_order_url()) - if ia.vat_id[:2] != str(ia.country): + if ia.vat_id[:2] != cc_to_vat_prefix(str(ia.country)): messages.error(self.request, _('Your VAT ID does not match the selected country.')) return redirect(self.get_order_url())