mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Allow to disable display of foreign currencies on invoices
This commit is contained in:
@@ -611,6 +611,7 @@ class EventSettingsSerializer(serializers.Serializer):
|
||||
'invoice_introductory_text',
|
||||
'invoice_additional_text',
|
||||
'invoice_footer_text',
|
||||
'invoice_eu_currencies',
|
||||
'cancel_allow_user',
|
||||
'cancel_allow_user_until',
|
||||
'cancel_allow_user_paid',
|
||||
|
||||
@@ -105,7 +105,7 @@ def build_invoice(invoice: Invoice) -> Invoice:
|
||||
|
||||
cc = str(ia.country)
|
||||
|
||||
if cc in EU_CURRENCIES and EU_CURRENCIES[cc] != invoice.event.currency:
|
||||
if cc in EU_CURRENCIES and EU_CURRENCIES[cc] != invoice.event.currency and invoice.event.settings.invoice_eu_currencies:
|
||||
invoice.foreign_currency_display = EU_CURRENCIES[cc]
|
||||
|
||||
if settings.FETCH_ECB_RATES:
|
||||
|
||||
@@ -198,6 +198,16 @@ DEFAULTS = {
|
||||
label=_("Show attendee names on invoices"),
|
||||
)
|
||||
},
|
||||
'invoice_eu_currencies': {
|
||||
'default': 'True',
|
||||
'type': bool,
|
||||
'form_class': forms.BooleanField,
|
||||
'serializer_class': serializers.BooleanField,
|
||||
'form_kwargs': dict(
|
||||
label=_("On invoices from one EU country into another EU country with a different currency, print the "
|
||||
"tax amounts in both currencies if possible"),
|
||||
)
|
||||
},
|
||||
'invoice_address_required': {
|
||||
'default': 'False',
|
||||
'form_class': forms.BooleanField,
|
||||
|
||||
@@ -686,7 +686,7 @@ class InvoiceSettingsForm(SettingsForm):
|
||||
'invoice_introductory_text',
|
||||
'invoice_additional_text',
|
||||
'invoice_footer_text',
|
||||
|
||||
'invoice_eu_currencies',
|
||||
]
|
||||
|
||||
invoice_generate_sales_channels = forms.MultipleChoiceField(
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
{% bootstrap_field form.invoice_footer_text layout="control" %}
|
||||
{% bootstrap_field form.invoice_logo_image layout="control" %}
|
||||
{% bootstrap_field form.invoice_address_explanation_text layout="control" %}
|
||||
{% bootstrap_field form.invoice_eu_currencies layout="control" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="form-group submit-group">
|
||||
|
||||
@@ -227,6 +227,32 @@ def test_reverse_charge_foreign_currency_data_too_old(env):
|
||||
assert inv.foreign_currency_rate_date is None
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_reverse_charge_foreign_currency_disabvled(env):
|
||||
event, order = env
|
||||
event.settings.invoice_eu_currencies = False
|
||||
|
||||
tr = event.tax_rules.first()
|
||||
tr.eu_reverse_charge = True
|
||||
tr.home_country = Country('DE')
|
||||
tr.save()
|
||||
|
||||
event.settings.set('invoice_language', 'en')
|
||||
InvoiceAddress.objects.create(company='Acme Company', street='221B Baker Street', zipcode='12345', city='Warsaw',
|
||||
country=Country('PL'), vat_id='PL123456780', vat_id_validated=True, order=order,
|
||||
is_business=True)
|
||||
|
||||
ocm = OrderChangeManager(order, None)
|
||||
ocm.recalculate_taxes()
|
||||
ocm.commit()
|
||||
assert not order.positions.filter(tax_value__gt=0).exists()
|
||||
|
||||
inv = generate_invoice(order)
|
||||
assert "reverse charge" in inv.additional_text.lower()
|
||||
assert inv.foreign_currency_rate is None
|
||||
assert inv.foreign_currency_rate_date is None
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_positions(env):
|
||||
event, order = env
|
||||
|
||||
Reference in New Issue
Block a user