Compare commits

..

2 Commits

Author SHA1 Message Date
Mira Weller
20eb84bc1f actually create the 0% tax rate 2025-01-20 14:51:14 +01:00
Mira Weller
40295f3785 Allow 0% tax rate on event creation
(Still warn if tax rate is not filled at all)
2025-01-16 11:24:53 +01:00
4 changed files with 5 additions and 12 deletions

View File

@@ -957,19 +957,12 @@ class BasePaymentProvider:
def cancel_payment(self, payment: OrderPayment):
"""
Will be called to cancel a payment. The default implementation fails if the payment is
``OrderPayment.PAYMENT_STATE_PENDING`` and ``abort_pending_allowed`` is false. Otherwise, it just sets the
payment state to canceled. In some cases you might want to modify this behaviour to notify the external provider
of the cancellation.
Will be called to cancel a payment. The default implementation just sets the payment state to canceled,
but in some cases you might want to notify an external provider.
On success, you should set ``payment.state = OrderPayment.PAYMENT_STATE_CANCELED`` (or call the super method).
On failure, you should raise a PaymentException.
"""
if payment.state == OrderPayment.PAYMENT_STATE_PENDING and not self.abort_pending_allowed:
raise PaymentException(_(
"This payment is already being processed and can not be canceled any more."
))
payment.state = OrderPayment.PAYMENT_STATE_CANCELED
payment.save(update_fields=['state'])

View File

@@ -231,7 +231,7 @@ class EventWizardBasicsForm(I18nModelForm):
raise ValidationError({
'timezone': _('Your default locale must be specified.')
})
if not data.get("no_taxes") and not data.get("tax_rate"):
if not data.get("no_taxes") and data.get("tax_rate") is None:
raise ValidationError({
'tax_rate': _('You have not specified a tax rate. If you do not want us to compute sales taxes, please '
'check "{field}" above.').format(field=self.fields["no_taxes"].label)

View File

@@ -313,7 +313,7 @@ class EventWizard(SafeSessionWizardView):
)
event.set_defaults()
if basics_data['tax_rate']:
if basics_data['tax_rate'] is not None:
if not event.settings.tax_rate_default or event.settings.tax_rate_default.rate != basics_data['tax_rate']:
event.settings.tax_rate_default = event.tax_rules.create(
name=LazyI18nString.from_gettext(gettext('VAT')),

View File

@@ -574,7 +574,7 @@ def test_pending_paypal_drop_fee(env, job):
env[2].save()
p = env[2].payments.create(
provider='paypal',
state=OrderPayment.PAYMENT_STATE_CREATED,
state=OrderPayment.PAYMENT_STATE_PENDING,
fee=fee,
amount=env[2].total
)