mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Do not enforce voucher constraints for bundled items
This commit is contained in:
@@ -226,11 +226,12 @@ class CartManager:
|
|||||||
|
|
||||||
def _check_item_constraints(self, op):
|
def _check_item_constraints(self, op):
|
||||||
if isinstance(op, self.AddOperation) or isinstance(op, self.ExtendOperation):
|
if isinstance(op, self.AddOperation) or isinstance(op, self.ExtendOperation):
|
||||||
if op.item.require_voucher and op.voucher is None:
|
if op.addon_to != 'FAKE':
|
||||||
raise CartError(error_messages['voucher_required'])
|
if op.item.require_voucher and op.voucher is None:
|
||||||
|
raise CartError(error_messages['voucher_required'])
|
||||||
|
|
||||||
if op.item.hide_without_voucher and (op.voucher is None or not op.voucher.show_hidden_items):
|
if op.item.hide_without_voucher and (op.voucher is None or not op.voucher.show_hidden_items):
|
||||||
raise CartError(error_messages['voucher_required'])
|
raise CartError(error_messages['voucher_required'])
|
||||||
|
|
||||||
if not op.item.is_available() or (op.variation and not op.variation.active):
|
if not op.item.is_available() or (op.variation and not op.variation.active):
|
||||||
raise CartError(error_messages['unavailable'])
|
raise CartError(error_messages['unavailable'])
|
||||||
|
|||||||
@@ -509,12 +509,14 @@ def _check_positions(event: Event, now_dt: datetime, positions: List[CartPositio
|
|||||||
if cp.seat:
|
if cp.seat:
|
||||||
seats_seen.add(cp.seat)
|
seats_seen.add(cp.seat)
|
||||||
|
|
||||||
if cp.item.require_voucher and cp.voucher is None:
|
if cp.item.require_voucher and cp.voucher is None and not cp.is_bundled:
|
||||||
delete(cp)
|
delete(cp)
|
||||||
err = err or error_messages['voucher_required']
|
err = err or error_messages['voucher_required']
|
||||||
break
|
break
|
||||||
|
|
||||||
if cp.item.hide_without_voucher and (cp.voucher is None or not cp.voucher.show_hidden_items or not cp.voucher.applies_to(cp.item, cp.variation)):
|
if cp.item.hide_without_voucher and (
|
||||||
|
cp.voucher is None or not cp.voucher.show_hidden_items or not cp.voucher.applies_to(cp.item, cp.variation)
|
||||||
|
) and not cp.is_bundled:
|
||||||
delete(cp)
|
delete(cp)
|
||||||
cp.delete()
|
cp.delete()
|
||||||
err = error_messages['voucher_required']
|
err = error_messages['voucher_required']
|
||||||
|
|||||||
Reference in New Issue
Block a user