mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Do not allow to cancel gift card positions
This commit is contained in:
@@ -1167,6 +1167,7 @@ class OrderChangeManager:
|
|||||||
'seat_required': _('The selected product requires you to select a seat.'),
|
'seat_required': _('The selected product requires you to select a seat.'),
|
||||||
'seat_forbidden': _('The selected product does not allow to select a seat.'),
|
'seat_forbidden': _('The selected product does not allow to select a seat.'),
|
||||||
'gift_card_change': _('You cannot change the price of a position that has been used to issue a gift card.'),
|
'gift_card_change': _('You cannot change the price of a position that has been used to issue a gift card.'),
|
||||||
|
'gift_card_cancel': _('You cannot cancel a position that has been used to issue a gift card.'),
|
||||||
}
|
}
|
||||||
ItemOperation = namedtuple('ItemOperation', ('position', 'item', 'variation'))
|
ItemOperation = namedtuple('ItemOperation', ('position', 'item', 'variation'))
|
||||||
SubeventOperation = namedtuple('SubeventOperation', ('position', 'subevent'))
|
SubeventOperation = namedtuple('SubeventOperation', ('position', 'subevent'))
|
||||||
@@ -1342,6 +1343,9 @@ class OrderChangeManager:
|
|||||||
self._operations.append(self.FeeValueOperation(fee, value))
|
self._operations.append(self.FeeValueOperation(fee, value))
|
||||||
|
|
||||||
def cancel(self, position: OrderPosition):
|
def cancel(self, position: OrderPosition):
|
||||||
|
if position.issued_gift_cards.exists():
|
||||||
|
raise OrderError(self.error_messages['gift_card_cancel'])
|
||||||
|
|
||||||
self._totaldiff -= position.price
|
self._totaldiff -= position.price
|
||||||
self._quotadiff.subtract(position.quotas)
|
self._quotadiff.subtract(position.quotas)
|
||||||
self._operations.append(self.CancelOperation(position))
|
self._operations.append(self.CancelOperation(position))
|
||||||
|
|||||||
Reference in New Issue
Block a user