mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
New data model for default tax rule and new options for cancellation fees (#4962)
* New data model for default tax rule * Remove misleading empty label when field is not optional * Allow to split cancellation fee * Fix API and tests * Update migration * Update src/tests/api/test_taxrules.py Co-authored-by: luelista <weller@rami.io> * Update src/tests/api/test_taxrules.py Co-authored-by: luelista <weller@rami.io> * Review note * Update src/pretix/base/models/tax.py Co-authored-by: luelista <weller@rami.io> * Flip API behaviour for default * Fix failing tests * Fix failing test * Split migration --------- Co-authored-by: luelista <weller@rami.io>
This commit is contained in:
@@ -181,8 +181,9 @@ class EventWizard(SafeSessionWizardView):
|
||||
initial['location'] = self.clone_from.location
|
||||
initial['timezone'] = self.clone_from.settings.timezone
|
||||
initial['locale'] = self.clone_from.settings.locale
|
||||
if self.clone_from.settings.tax_rate_default:
|
||||
initial['tax_rate'] = self.clone_from.settings.tax_rate_default.rate
|
||||
tax_rule = self.clone_from.cached_default_tax_rule
|
||||
if tax_rule:
|
||||
initial['tax_rate'] = tax_rule.rate
|
||||
if 'organizer' in self.request.GET:
|
||||
if step == 'foundation':
|
||||
try:
|
||||
@@ -325,10 +326,17 @@ class EventWizard(SafeSessionWizardView):
|
||||
event.set_defaults()
|
||||
|
||||
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(
|
||||
if self.clone_from:
|
||||
default_tax_rule = self.clone_from.cached_default_tax_rule
|
||||
elif copy_data and copy_data['copy_from_event']:
|
||||
default_tax_rule = from_event.cached_default_tax_rule
|
||||
else:
|
||||
default_tax_rule = None
|
||||
if not default_tax_rule or default_tax_rule.rate != basics_data['tax_rate']:
|
||||
event.tax_rules.create(
|
||||
name=LazyI18nString.from_gettext(gettext('VAT')),
|
||||
rate=basics_data['tax_rate']
|
||||
rate=basics_data['tax_rate'],
|
||||
default=not default_tax_rule,
|
||||
)
|
||||
|
||||
event.settings.set('timezone', basics_data['timezone'])
|
||||
|
||||
Reference in New Issue
Block a user