This allows users to change the currency on a completed order while maintaining the same price values. Ouch.
Overriding the default ThankYouView fixes the problem:
class FixedThankYouView(ThankYouView):
template_name = 'shop/checkout/thank_you.html'
def get_context_data(self, **kwargs):
ctx = super(ShopTemplateView, self).get_context_data(**kwargs)
# Set the order status:
order = get_order_from_request(self.request)
# check if the order is completed, otherwise changing the currency causes the
# order to be saved again without recalculating new currency prices !!!!!
if order and not order.status == Order.COMPLETED:
order.status = Order.COMPLETED
order.save()
completed.send(sender=self, order=order)
else:
order = Order.objects.get_latest_for_user(self.request.user)
#TODO: Is this ever the case?
ctx.update({'order': order, })
# Empty the customers basket, to reflect that the purchase was
# completed
cart_object = get_or_create_cart(self.request)
cart_object.empty()
return ctx
This allows users to change the currency on a completed order while maintaining the same price values. Ouch.
Overriding the default ThankYouView fixes the problem: