forked from CGM_Public/pretix_original
Remove positivity constraint in apply_voucher
This commit is contained in:
@@ -461,8 +461,10 @@ class CartManager:
|
|||||||
bundled_sum += bundledprice
|
bundled_sum += bundledprice
|
||||||
|
|
||||||
price = self._get_price(p.item, p.variation, voucher, None, p.subevent, bundled_sum=bundled_sum)
|
price = self._get_price(p.item, p.variation, voucher, None, p.subevent, bundled_sum=bundled_sum)
|
||||||
|
"""
|
||||||
if price.gross > p.price:
|
if price.gross > p.price:
|
||||||
continue
|
continue
|
||||||
|
"""
|
||||||
|
|
||||||
voucher_use_diff[voucher] += 1
|
voucher_use_diff[voucher] += 1
|
||||||
ops.append((p.price - price.gross, self.VoucherOperation(p, voucher, price)))
|
ops.append((p.price - price.gross, self.VoucherOperation(p, voucher, price)))
|
||||||
|
|||||||
@@ -1827,6 +1827,7 @@ class CartTest(CartTestMixin, TestCase):
|
|||||||
assert cp2.voucher == v2
|
assert cp2.voucher == v2
|
||||||
assert cp2.price == Decimal('150.00')
|
assert cp2.price == Decimal('150.00')
|
||||||
|
|
||||||
|
"""
|
||||||
def test_voucher_apply_only_positive(self):
|
def test_voucher_apply_only_positive(self):
|
||||||
with scopes_disabled():
|
with scopes_disabled():
|
||||||
cp1 = CartPosition.objects.create(
|
cp1 = CartPosition.objects.create(
|
||||||
@@ -1849,6 +1850,7 @@ class CartTest(CartTestMixin, TestCase):
|
|||||||
cp2.refresh_from_db()
|
cp2.refresh_from_db()
|
||||||
assert cp1.voucher is None
|
assert cp1.voucher is None
|
||||||
assert cp2.voucher is None
|
assert cp2.voucher is None
|
||||||
|
"""
|
||||||
|
|
||||||
def test_voucher_apply_expired(self):
|
def test_voucher_apply_expired(self):
|
||||||
with scopes_disabled():
|
with scopes_disabled():
|
||||||
|
|||||||
Reference in New Issue
Block a user