mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Vouchers: Allow to set all addons or bundles as included (#3322)
Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
@@ -2832,8 +2832,12 @@ class CartPosition(AbstractPosition):
|
||||
if self.is_bundled:
|
||||
bundle = self.addon_to.item.bundles.filter(bundled_item=self.item, bundled_variation=self.variation).first()
|
||||
if bundle:
|
||||
listed_price = bundle.designated_price
|
||||
price_after_voucher = bundle.designated_price
|
||||
if self.addon_to.voucher_id and self.addon_to.voucher.all_bundles_included:
|
||||
listed_price = Decimal('0.00')
|
||||
price_after_voucher = Decimal('0.00')
|
||||
else:
|
||||
listed_price = bundle.designated_price
|
||||
price_after_voucher = bundle.designated_price
|
||||
|
||||
if listed_price != self.listed_price or price_after_voucher != self.price_after_voucher:
|
||||
self.listed_price = listed_price
|
||||
|
||||
@@ -296,6 +296,14 @@ class Voucher(LoggedModel):
|
||||
verbose_name=_("Shows hidden products that match this voucher"),
|
||||
default=True
|
||||
)
|
||||
all_addons_included = models.BooleanField(
|
||||
verbose_name=_("Offer all add-on products for free when redeeming this voucher"),
|
||||
default=False
|
||||
)
|
||||
all_bundles_included = models.BooleanField(
|
||||
verbose_name=_("Include all bundled products without a designated price when redeeming this voucher"),
|
||||
default=False
|
||||
)
|
||||
|
||||
objects = ScopedManager(organizer='event__organizer')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user