Fix bug when making context for mailing address
sometimes those belong to a non-person, e.g. customer
This commit is contained in:
parent
ffb33d00c8
commit
3e796e9164
|
@ -515,8 +515,7 @@ class PersonView(MasterView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_context_address(self, address):
|
def get_context_address(self, address):
|
||||||
person = address.person
|
context = {
|
||||||
return {
|
|
||||||
'uuid': address.uuid,
|
'uuid': address.uuid,
|
||||||
'street': address.street,
|
'street': address.street,
|
||||||
'street2': address.street2,
|
'street2': address.street2,
|
||||||
|
@ -524,9 +523,15 @@ class PersonView(MasterView):
|
||||||
'state': address.state,
|
'state': address.state,
|
||||||
'zipcode': address.zipcode,
|
'zipcode': address.zipcode,
|
||||||
'display': six.text_type(address),
|
'display': six.text_type(address),
|
||||||
'invalid': self.handler.address_is_invalid(person, address),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model = self.model
|
||||||
|
if isinstance(address, model.PersonMailingAddress):
|
||||||
|
person = address.person
|
||||||
|
context['invalid'] = self.handler.address_is_invalid(person, address)
|
||||||
|
|
||||||
|
return context
|
||||||
|
|
||||||
def get_context_customers(self, person):
|
def get_context_customers(self, person):
|
||||||
data = []
|
data = []
|
||||||
for cp in person._customers:
|
for cp in person._customers:
|
||||||
|
|
Loading…
Reference in a new issue