mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Fix voucher application on "free price" items (Z#23183254) (#4863)
* Do not apply vouchers on "free price" items where more than minimum price is selected * Do apply vouchers on "free price" items if exactly the minimum price is selected * Update cart.py * Add test cases, fix bug in adjacent test * Fix code style --------- Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
@@ -624,6 +624,9 @@ class CartManager:
|
||||
if p.is_bundled:
|
||||
continue
|
||||
|
||||
if p.custom_price_input and p.custom_price_input != p.listed_price:
|
||||
continue
|
||||
|
||||
if p.listed_price is None:
|
||||
if p.addon_to_id and is_included_for_free(p.item, p.addon_to):
|
||||
listed_price = Decimal('0.00')
|
||||
@@ -1346,8 +1349,10 @@ class CartManager:
|
||||
|
||||
op.position.price_after_voucher = op.price_after_voucher
|
||||
op.position.voucher = op.voucher
|
||||
if op.position.custom_price_input and op.position.custom_price_input == op.position.listed_price:
|
||||
op.position.custom_price_input = op.price_after_voucher
|
||||
# op.position.price will be set in recompute_final_prices_and_taxes
|
||||
op.position.save(update_fields=['price_after_voucher', 'voucher'])
|
||||
op.position.save(update_fields=['price_after_voucher', 'voucher', 'custom_price_input'])
|
||||
vouchers_ok[op.voucher] -= 1
|
||||
|
||||
if op.voucher.all_bundles_included or op.voucher.all_addons_included:
|
||||
|
||||
Reference in New Issue
Block a user