Commit dc7a465a authored by Nico Schottelius's avatar Nico Schottelius

Fix exception if first order does not have billing address

parent 65440ab2
......@@ -327,7 +327,10 @@ class Bill(models.Model):
orders = Order.objects.filter(bill=self)
# The genrate_for method makes sure all the orders of a bill share the
# same billing address. TODO: It would be nice to enforce that somehow...
return orders[0].billing_address
if orders:
return orders[0].billing_address
else:
return None
# TODO: split this huuuge method!
@staticmethod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment