Do not enforce voucher constraints for bundled items

This commit is contained in:
Raphael Michel
2019-09-03 11:51:29 +02:00
parent 129c360fff
commit 6c830a7d36
2 changed files with 9 additions and 6 deletions

View File

@@ -226,6 +226,7 @@ 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.addon_to != 'FAKE':
if op.item.require_voucher and op.voucher is None: if op.item.require_voucher and op.voucher is None:
raise CartError(error_messages['voucher_required']) raise CartError(error_messages['voucher_required'])

View File

@@ -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']