mirror of
https://github.com/pretix/pretix.git
synced 2026-08-05 09:57:49 +00:00
OrderChangeManager: Prevent usage on canceled orders
This commit is contained in:
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user