Fix exception if first order does not have billing address

This commit is contained in:
Nico Schottelius 2020-05-10 14:22:09 +02:00
parent 65440ab2ef
commit dc7a465a8c

View file

@ -327,7 +327,10 @@ class Bill(models.Model):
orders = Order.objects.filter(bill=self) orders = Order.objects.filter(bill=self)
# The genrate_for method makes sure all the orders of a bill share the # 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... # same billing address. TODO: It would be nice to enforce that somehow...
if orders:
return orders[0].billing_address return orders[0].billing_address
else:
return None
# TODO: split this huuuge method! # TODO: split this huuuge method!
@staticmethod @staticmethod