Resolves #17 - cannot generate invoice if there are no product items
This commit is contained in:
parent
812cc0b9c8
commit
c9a62db774
1 changed files with 4 additions and 1 deletions
|
@ -67,8 +67,11 @@ class InvoiceController(object):
|
||||||
)
|
)
|
||||||
invoice.save()
|
invoice.save()
|
||||||
|
|
||||||
# TODO: calculate line items.
|
|
||||||
product_items = rego.ProductItem.objects.filter(cart=cart)
|
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_items = product_items.order_by(
|
||||||
"product__category__order", "product__order"
|
"product__category__order", "product__order"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue