forked from CGM_Public/pretix_original
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.is_valid(raise_exception=True)
|
||||||
serializer.save()
|
serializer.save()
|
||||||
new_data = serializer.data
|
new_data = serializer.data
|
||||||
instance.order.create_transactions()
|
|
||||||
|
|
||||||
if old_data != new_data:
|
if old_data != new_data:
|
||||||
log_data = self.request.data
|
log_data = self.request.data
|
||||||
|
|||||||
@@ -1056,12 +1056,14 @@ class Order(LockModel, LoggedModel):
|
|||||||
if p.canceled and not _backfill_before_cancellation:
|
if p.canceled and not _backfill_before_cancellation:
|
||||||
continue
|
continue
|
||||||
target_transaction_count[Transaction.key(p)] += 1
|
target_transaction_count[Transaction.key(p)] += 1
|
||||||
|
p._transaction_key_reset()
|
||||||
|
|
||||||
fees = self.fees.all() if fees is None else fees
|
fees = self.fees.all() if fees is None else fees
|
||||||
for f in fees:
|
for f in fees:
|
||||||
if f.canceled and not _backfill_before_cancellation:
|
if f.canceled and not _backfill_before_cancellation:
|
||||||
continue
|
continue
|
||||||
target_transaction_count[Transaction.key(f)] += 1
|
target_transaction_count[Transaction.key(f)] += 1
|
||||||
|
f._transaction_key_reset()
|
||||||
|
|
||||||
keys = set(target_transaction_count.keys()) | set(current_transaction_count.keys())
|
keys = set(target_transaction_count.keys()) | set(current_transaction_count.keys())
|
||||||
create = []
|
create = []
|
||||||
@@ -2076,8 +2078,16 @@ class OrderFee(models.Model):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
if not self.get_deferred_fields():
|
if not self.get_deferred_fields():
|
||||||
self.__initial_transaction_key = Transaction.key(self)
|
self._transaction_key_reset()
|
||||||
self.__initial_canceled = self.canceled
|
|
||||||
|
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):
|
def __str__(self):
|
||||||
if self.description:
|
if self.description:
|
||||||
@@ -2197,8 +2207,16 @@ class OrderPosition(AbstractPosition):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
if not self.get_deferred_fields():
|
if not self.get_deferred_fields():
|
||||||
self.__initial_transaction_key = Transaction.key(self)
|
self._transaction_key_reset()
|
||||||
self.__initial_canceled = self.canceled
|
|
||||||
|
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:
|
class Meta:
|
||||||
verbose_name = _("Order position")
|
verbose_name = _("Order position")
|
||||||
|
|||||||
Reference in New Issue
Block a user