forked from uncloud/uncloud
Fix exception if first order does not have billing address
This commit is contained in:
parent
65440ab2ef
commit
dc7a465a8c
1 changed files with 4 additions and 1 deletions
|
@ -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...
|
||||||
return orders[0].billing_address
|
if orders:
|
||||||
|
return orders[0].billing_address
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
# TODO: split this huuuge method!
|
# TODO: split this huuuge method!
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in a new issue