API: Fix order total after order change operation (#2700)

This commit is contained in:
Raphael Michel
2022-06-27 12:41:54 +02:00
committed by GitHub
parent c6c8e00f43
commit 5a6b7d783b
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -2304,6 +2304,11 @@ class OrderChangeManager:
# Do nothing
return
# Clear prefetched objects cache of order. We're going to modify the positions and fees and we have no guarantee
# that every operation tuple points to a position/fee instance that has been fetched from the same object cache,
# so it's dangerous to keep the cache around.
self.order._prefetched_objects_cache = {}
# finally, incorporate difference in payment fees
self._payment_fee_diff()
+2
View File
@@ -1673,6 +1673,8 @@ def test_order_change_patch(token_client, organizer, event, order, quota):
assert p.item == item2
f.refresh_from_db()
assert f.value == Decimal('10.00')
order.refresh_from_db()
assert order.total == Decimal('109.44')
@pytest.mark.django_db