mirror of
https://github.com/pretix/pretix.git
synced 2026-08-25 13:12:00 +00:00
Clone discounts when cloning events
This commit is contained in:
@@ -700,7 +700,7 @@ class Event(EventMixin, LoggedModel):
|
|||||||
|
|
||||||
from ..signals import event_copy_data
|
from ..signals import event_copy_data
|
||||||
from . import (
|
from . import (
|
||||||
Item, ItemAddOn, ItemBundle, ItemCategory, ItemMetaValue, Question,
|
Discount, Item, ItemAddOn, ItemBundle, ItemCategory, ItemMetaValue, Question,
|
||||||
Quota,
|
Quota,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -810,6 +810,16 @@ class Event(EventMixin, LoggedModel):
|
|||||||
q.variations.add(variation_map[v.pk])
|
q.variations.add(variation_map[v.pk])
|
||||||
self.items.filter(hidden_if_available_id=oldid).update(hidden_if_available=q)
|
self.items.filter(hidden_if_available_id=oldid).update(hidden_if_available=q)
|
||||||
|
|
||||||
|
for d in Discount.objects.filter(event=other).prefetch_related('condition_limit_products'):
|
||||||
|
items = list(d.condition_limit_products.all())
|
||||||
|
d.pk = None
|
||||||
|
d.event = self
|
||||||
|
d.save()
|
||||||
|
d.log_action('pretix.object.cloned')
|
||||||
|
for i in items:
|
||||||
|
if i.pk in item_map:
|
||||||
|
d.condition_limit_products.add(item_map[i.pk])
|
||||||
|
|
||||||
question_map = {}
|
question_map = {}
|
||||||
for q in Question.objects.filter(event=other).prefetch_related('items', 'options'):
|
for q in Question.objects.filter(event=other).prefetch_related('items', 'options'):
|
||||||
items = list(q.items.all())
|
items = list(q.items.all())
|
||||||
|
|||||||
Reference in New Issue
Block a user