Ensure that orders always contain a valid billing address
I had to patch the current code for the Bill class as follows:
@property
def billing_address(self):
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...
if orders:
return orders[0].billing_address
else:
return None
Correct way of fixing is to disallow an order to be created without having a valid billing address