13. Managing the Deliver Process

Depending on the merchant’s setup, an order can be considered as one inseparably unit, or if partial shipping shall be allowed, as a collection of single products, which can be delivered individually.

To enable partial shipping, assure the instantiation of both classes shop.models.delivery.BaseDelivery and shop.models.delivery.BaseDeliveryItem. The easiest way to do this is to import the materialized classes into an existing model class:

from shop.models.defaults.delivery import Delivery, DeliveryItem

13.1. Partial Delivery Workflow

The class implementing the Order, requires additional methods provided by the mixin class shop.shipping.delivery.PartialDeliveryWorkflowMixin. Mix this class into the Order class by configuring

    # other workflow mixins


Do not combine this mixin with the class CommissionGoodsWorkflowMixin.

13.2. Administration Backend

To control partial delivery, add the class shop.admin.delivery.DeliveryOrderAdminMixin to the amin class class implementing an Order:

from django.contrib import admin
from shop.admin.order import BaseOrderAdmin
from shop.models.defaults.order import Order
from shop.admin.delivery import DeliveryOrderAdminMixin

class OrderAdmin(DeliveryOrderAdminMixin, BaseOrderAdmin):

13.3. Implementation Details

When partial delivery is activated, two additional tables are added to the database, one for each delivery and one for each delivered order item. This allows us to split up the quantity of in ordered item into two or more delivery objects. This can be useful, if a product is sold out, but the merchant wants to ship whatever is available on stock. He then creates a delivery object and assigns the available quantity to each linked delivery item.

If a product is not available at all anymore, the merchant can alternatively cancel that order item.