From bb82d013e636682a66826c81c30de200e2ea0d83 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 24 Jan 2023 18:54:46 +0100 Subject: [PATCH] OrderChangeManager: Prevent usage on canceled orders --- src/pretix/base/services/orders.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pretix/base/services/orders.py b/src/pretix/base/services/orders.py index cd06735f0..b5c2b192e 100644 --- a/src/pretix/base/services/orders.py +++ b/src/pretix/base/services/orders.py @@ -1343,6 +1343,7 @@ def notify_user_changed_order(order, user=None, auth=None, invoices=[]): class OrderChangeManager: error_messages = { + 'order_canceled': _('You cannot change a canceled order.'), 'product_without_variation': _('You need to select a variation of the product.'), 'quota': _('The quota {name} does not have enough capacity left to perform the operation.'), 'quota_missing': _('There is no quota defined that allows this operation.'), @@ -1390,6 +1391,9 @@ class OrderChangeManager: self._invoice_dirty = False self._invoices = [] + if order.status == Order.STATUS_CANCELED: + raise OrderError(self.error_messages['order_canceled']) + def change_item(self, position: OrderPosition, item: Item, variation: Optional[ItemVariation]): if (not variation and item.has_variations) or (variation and variation.item_id != item.pk): raise OrderError(self.error_messages['product_without_variation'])