Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Moved order.create_history_entry in start_payment

michal5c82cdfbed1e
diff --git a/saleor/order/utils.py b/saleor/order/utils.py
index 11bab68ed0..ecc04892fd 100644
--- a/saleor/order/utils.py
+++ b/saleor/order/utils.py
@@ -35,8 +35,7 @@ def order_status_change(sender, instance, **kwargs):
order.change_status(OrderStatus.FULLY_PAID)
order.create_history_entry(
status=OrderStatus.FULLY_PAID, comment=pgettext_lazy(
- 'Order status change',
- 'Order fully paid'))
+ 'Order status change', 'Order fully paid'))
instance.send_confirmation_email()
try:
analytics.report_order(order.tracking_client_id, order)
diff --git a/saleor/order/views.py b/saleor/order/views.py
index 89e41210c5..c39e42ea37 100644
--- a/saleor/order/views.py
+++ b/saleor/order/views.py
@@ -95,14 +95,14 @@ def start_payment(request, order, variant):
raise Http404('%r is not a valid payment variant' % (variant,))
with transaction.atomic():
order.change_status(OrderStatus.PAYMENT_PENDING)
- order.create_history_entry(
- status=OrderStatus.PAYMENT_PENDING, comment=pgettext_lazy(
- 'Order status change', 'Order is waiting for payment'))
payment, dummy_created = Payment.objects.get_or_create(
variant=variant, status=PaymentStatus.WAITING, order=order,
defaults=defaults)
try:
form = payment.get_form(data=request.POST or None)
+ order.create_history_entry(
+ status=OrderStatus.PAYMENT_PENDING, comment=pgettext_lazy(
+ 'Order status change', 'Order is waiting for payment'))
except RedirectNeeded as redirect_to:
return redirect(str(redirect_to))
except Exception: