From 187576eee54812e4e36a9e3b8201156514b4898b Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 6 Feb 2019 10:25:53 +0100 Subject: [PATCH] Fix a ProtectedError in cart handling FIx PRETIXEU-TR --- src/pretix/base/services/cart.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pretix/base/services/cart.py b/src/pretix/base/services/cart.py index e46fc2b7f0..9be624a1d2 100644 --- a/src/pretix/base/services/cart.py +++ b/src/pretix/base/services/cart.py @@ -371,7 +371,7 @@ class CartManager: # could cancel each other out quota-wise). However, we are not taking this performance # penalty for now as there is currently no outside interface that would allow building # such a transaction. - for cp in self.positions.all(): + for cp in self.positions.filter(addon_to__isnull=True): self._operations.append(self.RemoveOperation(position=cp)) def set_addons(self, addons): @@ -653,6 +653,7 @@ class CartManager: op.position.price = op.price.gross op.position.save() elif available_count == 0: + op.position.addons.all().delete() op.position.delete() else: raise AssertionError("ExtendOperation cannot affect more than one item")