mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Iterate cdb564970 to a fix that actually tackles the root cause
This commit is contained in:
@@ -1322,7 +1322,6 @@ class OrderPositionViewSet(viewsets.ModelViewSet):
|
||||
serializer.is_valid(raise_exception=True)
|
||||
serializer.save()
|
||||
new_data = serializer.data
|
||||
instance.order.create_transactions()
|
||||
|
||||
if old_data != new_data:
|
||||
log_data = self.request.data
|
||||
|
||||
@@ -1056,12 +1056,14 @@ class Order(LockModel, LoggedModel):
|
||||
if p.canceled and not _backfill_before_cancellation:
|
||||
continue
|
||||
target_transaction_count[Transaction.key(p)] += 1
|
||||
p._transaction_key_reset()
|
||||
|
||||
fees = self.fees.all() if fees is None else fees
|
||||
for f in fees:
|
||||
if f.canceled and not _backfill_before_cancellation:
|
||||
continue
|
||||
target_transaction_count[Transaction.key(f)] += 1
|
||||
f._transaction_key_reset()
|
||||
|
||||
keys = set(target_transaction_count.keys()) | set(current_transaction_count.keys())
|
||||
create = []
|
||||
@@ -2076,8 +2078,16 @@ class OrderFee(models.Model):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
if not self.get_deferred_fields():
|
||||
self.__initial_transaction_key = Transaction.key(self)
|
||||
self.__initial_canceled = self.canceled
|
||||
self._transaction_key_reset()
|
||||
|
||||
def refresh_from_db(self, using=None, fields=None):
|
||||
if not self.get_deferred_fields():
|
||||
self._transaction_key_reset()
|
||||
return super().refresh_from_db(using, fields)
|
||||
|
||||
def _transaction_key_reset(self):
|
||||
self.__initial_transaction_key = Transaction.key(self)
|
||||
self.__initial_canceled = self.canceled
|
||||
|
||||
def __str__(self):
|
||||
if self.description:
|
||||
@@ -2197,8 +2207,16 @@ class OrderPosition(AbstractPosition):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
if not self.get_deferred_fields():
|
||||
self.__initial_transaction_key = Transaction.key(self)
|
||||
self.__initial_canceled = self.canceled
|
||||
self._transaction_key_reset()
|
||||
|
||||
def refresh_from_db(self, using=None, fields=None):
|
||||
if not self.get_deferred_fields():
|
||||
self._transaction_key_reset()
|
||||
return super().refresh_from_db(using, fields)
|
||||
|
||||
def _transaction_key_reset(self):
|
||||
self.__initial_transaction_key = Transaction.key(self)
|
||||
self.__initial_canceled = self.canceled
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Order position")
|
||||
|
||||
Reference in New Issue
Block a user