registrasion/reporting/views.py
def product_status(request, form):
    ''' Summarises the inventory status of the given items, grouping by
    invoice status. '''

    products = form.cleaned_data["product"]
    categories = form.cleaned_data["category"]

    items = commerce.ProductItem.objects.filter(
        Q(product__in=products) | Q(product__category__in=categories),
    ).select_related("cart", "product")

    items = group_by_cart_status(
        items,
        ["product__category__order", "product__order"],
        ["product", "product__category__name", "product__name"],
    )

    headings = [
        "Product", "Paid", "Reserved", "Unreserved", "Refunded",
    ]
    data = []

    for item in items:
        data.append([
            "%s - %s" % (
                item["product__category__name"], item["product__name"]
            ),
            item["total_paid"],
            item["total_reserved"],
            item["total_unreserved"],
            item["total_refunded"],
        ])

    return ListReport("Inventory", headings, data)
def product_status(request, form):
    ''' Summarises the inventory status of the given items, grouping by
    invoice status. '''

    products = form.cleaned_data["product"]
    categories = form.cleaned_data["category"]

    items = commerce.ProductItem.objects.filter(
        Q(product__in=products) | Q(product__category__in=categories),
    ).select_related("cart", "product")

    items = group_by_cart_status(
        items,
        ["product__category__order", "product__order"],
        ["product", "product__category__name", "product__name"],
    )

    headings = [
        "Product", "Paid", "Reserved", "Unreserved", "Refunded",
    ]
    data = []

    for item in items:
        data.append([
            "%s - %s" % (
                item["product__category__name"], item["product__name"]
            ),
            item["total_paid"],
            item["total_reserved"],
            item["total_unreserved"],
            item["total_refunded"],
        ])

    return ListReport("Inventory", headings, data)
def product_status ( request , form ) : products = form . cleaned_data [ "product" ] categories = form . cleaned_data [ "category" ] items = commerce . ProductItem . objects . filter ( Q ( product__in = products ) | Q ( product__category__in = categories ) , ) . select_related ( "cart" , "product" ) items = group_by_cart_status ( items , [ "product__category__order" , "product__order" ] , [ "product" , "product__category__name" , "product__name" ] , ) headings = [ "Product" , "Paid" , "Reserved" , "Unreserved" , "Refunded" , ] data = [ ] for item in items : data . append ( [ "%s - %s" % ( item [ "product__category__name" ] , item [ "product__name" ] ) , item [ "total_paid" ] , item [ "total_reserved" ] , item [ "total_unreserved" ] , item [ "total_refunded" ] , ] ) return ListReport ( "Inventory" , headings , data )
Summarises the inventory status of the given items, grouping by
    invoice status.
Summarises the inventory status of the given items grouping by invoice status .