Fix voucher validation in CartManager

This commit is contained in:
Raphael Michel
2019-07-08 17:50:22 +02:00
parent 08bfe13dc3
commit 2352f3b811
2 changed files with 5 additions and 2 deletions

View File

@@ -225,7 +225,10 @@ class CartManager:
def _check_item_constraints(self, op):
if isinstance(op, self.AddOperation) or isinstance(op, self.ExtendOperation):
if (op.item.require_voucher or op.item.hide_without_voucher) and (op.voucher is None or not op.voucher.show_hidden_items):
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):
raise CartError(error_messages['voucher_required'])
if not op.item.is_available() or (op.variation and not op.variation.active):