fix use_parent_address

This commit is contained in:
ebrehault 2013-09-18 16:51:38 +02:00
parent 991f350ffb
commit e515bca74f
1 changed files with 6 additions and 1 deletions

View File

@ -230,9 +230,14 @@ def default_use_parent_address(adapter):
"""We don't use parent address by default for contacts and level-0 organizations
"""
from collective.contact.core.content.directory import IDirectory
try:
parent = adapter.view._parent
except AttributeError:
return False
if adapter.view._parent.portal_type == 'person':
return False
if adapter.view._parent.portal_type == 'organization' \
elif adapter.view._parent.portal_type == 'organization' \
and IDirectory.providedBy(adapter.context):
return False
else: