Resolves #17 - cannot generate invoice if there are no product items

This commit is contained in:
Christopher Neugebauer 2016-04-06 17:02:11 +10:00
parent 812cc0b9c8
commit c9a62db774

View file

@ -67,8 +67,11 @@ class InvoiceController(object):
)
invoice.save()
# TODO: calculate line items.
product_items = rego.ProductItem.objects.filter(cart=cart)
if len(product_items) == 0:
raise ValidationError("Your cart is empty.")
product_items = product_items.order_by(
"product__category__order", "product__order"
)