Event: copy sales_channels when copying events

This commit is contained in:
Raphael Michel
2021-05-25 09:36:53 +02:00
parent 8955efc890
commit a519310fb8
2 changed files with 4 additions and 0 deletions

View File

@@ -400,6 +400,7 @@ class CloneEventSerializer(EventSerializer):
testmode = validated_data.pop('testmode', None) testmode = validated_data.pop('testmode', None)
has_subevents = validated_data.pop('has_subevents', None) has_subevents = validated_data.pop('has_subevents', None)
tz = validated_data.pop('timezone', None) tz = validated_data.pop('timezone', None)
sales_channels = validated_data.pop('sales_channels', None)
new_event = super().create(validated_data) new_event = super().create(validated_data)
event = Event.objects.filter(slug=self.context['event'], organizer=self.context['organizer'].pk).first() event = Event.objects.filter(slug=self.context['event'], organizer=self.context['organizer'].pk).first()
@@ -411,6 +412,8 @@ class CloneEventSerializer(EventSerializer):
new_event.is_public = is_public new_event.is_public = is_public
if testmode is not None: if testmode is not None:
new_event.testmode = testmode new_event.testmode = testmode
if sales_channels is not None:
new_event.sales_channels = sales_channels
if has_subevents is not None: if has_subevents is not None:
new_event.has_subevents = has_subevents new_event.has_subevents = has_subevents
new_event.save() new_event.save()

View File

@@ -636,6 +636,7 @@ class Event(EventMixin, LoggedModel):
if other.date_admission: if other.date_admission:
self.date_admission = self.date_from + (other.date_admission - other.date_from) self.date_admission = self.date_from + (other.date_admission - other.date_from)
self.testmode = other.testmode self.testmode = other.testmode
self.sales_channels = other.sales_channels
self.save() self.save()
self.log_action('pretix.object.cloned', data={'source': other.slug, 'source_id': other.pk}) self.log_action('pretix.object.cloned', data={'source': other.slug, 'source_id': other.pk})