Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix order status depending on flag (#16021)
Krzysztof Kwaśniakc054941d6d87
diff --git a/saleor/graphql/order/mutations/draft_order_complete.py b/saleor/graphql/order/mutations/draft_order_complete.pyindex 46e0ca5000..8c78e9fe33 100644--- a/saleor/graphql/order/mutations/draft_order_complete.py+++ b/saleor/graphql/order/mutations/draft_order_complete.py@@ -114,7 +114,12 @@ class DraftOrderComplete(BaseMutation):validate_draft_order(order, order.lines.all(), country, manager)with traced_atomic_transaction():cls.update_user_fields(order)- order.status = OrderStatus.UNFULFILLED+ channel = order.channel+ order.status = (+ OrderStatus.UNFULFILLED+ if channel.automatically_confirm_all_new_orders+ else OrderStatus.UNCONFIRMED+ )if not order.is_shipping_required():order.shipping_method_name = None@@ -129,7 +134,6 @@ class DraftOrderComplete(BaseMutation):update_order_display_gross_prices(order)order.save()- channel = order.channelcls.setup_voucher_customer(order, channel)order_lines_info = []for line in order.lines.all():diff --git a/saleor/graphql/order/tests/mutations/test_draft_order_complete.py b/saleor/graphql/order/tests/mutations/test_draft_order_complete.pyindex 47d79288b0..fe860ed265 100644--- a/saleor/graphql/order/tests/mutations/test_draft_order_complete.py+++ b/saleor/graphql/order/tests/mutations/test_draft_order_complete.py@@ -106,6 +106,7 @@ def test_draft_order_complete(assert data["status"] == order.status.upper()assert data["origin"] == OrderOrigin.DRAFT.upper()assert order.search_vector+ assert order.status == OrderStatus.UNFULFILLEDfor line in order.lines.all():allocation = line.allocations.get()@@ -161,6 +162,7 @@ def test_draft_order_complete_no_automatically_confirm_all_new_orders(assert data["status"] == order.status.upper()assert data["origin"] == OrderOrigin.DRAFT.upper()assert order.search_vector+ assert order.status == OrderStatus.UNCONFIRMEDfor line in order.lines.all():allocation = line.allocations.get()