forked from CGM_Public/pretix_original
Invoice address: Improve VAT ID input (#5647)
* Remove unmaintained depdendency vat_moss * VAT ID normalization: Auto-add country codes * VAT ID: County-specific labels * Invoice address: Allow to set VAT ID as required per country * Fix failing tests * Update src/pretix/base/settings.py Co-authored-by: luelista <weller@rami.io> * Review fixes --------- Co-authored-by: luelista <weller@rami.io>
This commit is contained in:
@@ -629,13 +629,40 @@ DEFAULTS = {
|
||||
'form_kwargs': dict(
|
||||
label=_("Ask for VAT ID"),
|
||||
help_text=format_lazy(
|
||||
_("Only works if an invoice address is asked for. VAT ID is never required and only requested from "
|
||||
"business customers in the following countries: {countries}"),
|
||||
_("Only works if an invoice address is asked for. VAT ID is only requested from business customers "
|
||||
"in the following countries: {countries}."),
|
||||
countries=lazy(lambda *args: ', '.join(sorted(gettext(Country(cc).name) for cc in VAT_ID_COUNTRIES)), str)()
|
||||
),
|
||||
widget=forms.CheckboxInput(attrs={'data-checkbox-dependency': '#id_invoice_address_asked'}),
|
||||
)
|
||||
},
|
||||
'invoice_address_vatid_required_countries': {
|
||||
'default': ['IT', 'GR'],
|
||||
'type': list,
|
||||
'form_class': forms.MultipleChoiceField,
|
||||
'serializer_class': serializers.MultipleChoiceField,
|
||||
'serializer_kwargs': dict(
|
||||
choices=lazy(
|
||||
lambda *args: sorted([(cc, gettext(Country(cc).name)) for cc in VAT_ID_COUNTRIES], key=lambda c: c[1]),
|
||||
list
|
||||
)(),
|
||||
),
|
||||
'form_kwargs': dict(
|
||||
label=_("Require VAT ID in"),
|
||||
choices=lazy(
|
||||
lambda *args: sorted([(cc, gettext(Country(cc).name)) for cc in VAT_ID_COUNTRIES], key=lambda c: c[1]),
|
||||
list
|
||||
)(),
|
||||
help_text=format_lazy(
|
||||
_("VAT ID is optional by default, because not all businesses are assigned a VAT ID in all countries. "
|
||||
"VAT ID will be required for all business addresses in the selected countries."),
|
||||
),
|
||||
widget=forms.CheckboxSelectMultiple(attrs={
|
||||
"class": "scrolling-multiple-choice",
|
||||
'data-display-dependency': '#id_invoice_address_vatid'
|
||||
}),
|
||||
)
|
||||
},
|
||||
'invoice_address_explanation_text': {
|
||||
'default': '',
|
||||
'type': LazyI18nString,
|
||||
|
||||
Reference in New Issue
Block a user