Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update docs with fulfillments
Anna Siwik53f8fbb05a37
diff --git a/docs/architecture/orders.rst b/docs/architecture/orders.rstindex 9ebe447923..6594928079 100644--- a/docs/architecture/orders.rst+++ b/docs/architecture/orders.rst@@ -4,50 +4,33 @@ Order ManagementOrders are created after customers complete the checkout process. The `Order` object itself contains only general information about the customer's order.-Delivery Group-----------------The delivery group represents a group of ordered items. By default, groups are created along with an order by splitting the cart into parts, depending whether a product requires shipping or not.+Fulfillment+------------Most of the order management actions are taken on the delivery groups and include changing their statuses.+The fulfillment represents a group of shipped items with corresponding tracking number. Fulfillments are created by a shop operator to mark selected products in an order as fulfilled.-There are three possible delivery group statuses:+There are two possible fulfillment statuses:- ``NEW``- The default status of newly created delivery groups.--- ``SHIPPED``- The delivery group has been marked as shipped by a shop operator. Only ``NEW`` groups can be marked as shipped.--- ``CANCELLED``- The delivery group has been cancelled by a shop operator. Both ``NEW`` and ``SHIPPED`` groups can be marked as cancelled.---Delivery Group statuses flow-----------------------------+ The default status of newly created fulfillments.-.. Graph is generated from transitions.dot file in graphs folder. You can edit it and convert to png (with graphviz installed) by executing: dot -Tpng docs/graphs/transitions.dot > docs/img/transitions.png-.. image:: ../img/transitions.png--Regular flow of statuses is from ``NEW`` to ``SHIPPED``. For managing states Saleor uses `django-fsm <https://github.com/kmmbvnr/django-fsm>`_ package. Actions performed within changing status are placed in DeliveryGroup model and are as follows:--- ``process(cart_lines, discounts=None)``- Adds specified cart lines to a group with optionally charged discounts and allocates quantity in corresponding stocks. Performed during creating order in checkout process.--- ``ship()``- Decreases quantity in corresponding stocks. Performed just after shop operator marks group as shipped.--- ``cancel()``- Deallocates or increases quantity in corresponding stocks, depending whether ``NEW`` or ``SHIPPED`` group is cancelled respectively. Performed just after shop operator marks group as cancelled.+- ``CANCELED``+ The fulfillment canceled by a shop operator. This action is irreversible.Order statuses---------------Order status is deduced based on statuses of its delivery groups. There are two possible statuses:+Order status is based on statuses of its fulfillments. There are four possible statuses:++- ``UNFULFILLED``+ There are no fulfillments related to an order or each one is canceled. An action by a shop operator is required to continue order processing.++- ``PARTIALLY FULFILLED``+ There are some fulfillments with ``FULFILLED`` status related to an order. An action by a shop operator is required to continue order processing.-- ``OPEN``- There is at least one delivery group with the ``NEW`` status. An action by a shop operator is required to continue order processing.+- ``FULFILLED``+ Each order line is fulfilled in existing fulfillments. Order doesn't require further actions by a shop operator.-- ``CLOSED``- There are no delivery groups with the ``NEW`` status. Order doesn't require further actions by a shop operator.+- ``CANCELED``+ Order has been canceled. Every fulfillment (if there is any) has ``CANCELED`` status. Order doesn't require further actions by a shop operator.diff --git a/docs/graphs/transitions.dot b/docs/graphs/transitions.dotdeleted file mode 100644index 82d0918177..0000000000--- a/docs/graphs/transitions.dot+++ /dev/null@@ -1,14 +0,0 @@-digraph {- rankdir="LR";- subgraph cluster_order_DeliveryGroup_status {- style=invis;- "order.delivery_group.status._initial" [label="" shape=point]- "order.delivery_group.status.new" [label=new shape=circle width=1 fixedsize=true style=filled fillcolor="#32C8FF"]- "order.delivery_group.status.shipped" [label=shipped shape=circle width=1 fixedsize=true style=filled fillcolor="#29BF00"]- "order.delivery_group.status.cancelled" [label=cancelled shape=circle width=1 fixedsize=true style=filled fillcolor="#E2E2E2"]- "order.delivery_group.status._initial" -> "order.delivery_group.status.new" [label=process]- "order.delivery_group.status.new" -> "order.delivery_group.status.cancelled" [label=cancel]- "order.delivery_group.status.new" -> "order.delivery_group.status.shipped" [label=ship]- "order.delivery_group.status.shipped" -> "order.delivery_group.status.cancelled" [label=cancel]- }-}diff --git a/docs/img/transitions.png b/docs/img/transitions.pngdeleted file mode 100644index 19b3797425..0000000000Binary files a/docs/img/transitions.png and /dev/null differ