diff --git a/product/ERP5Type/id_as_reference.py b/product/ERP5Type/id_as_reference.py index d4035d27b1c09466be3b4aba7961286060ffc8ea..f7b1c19465f5e3d9f28ce456d4ce41f7299fb8a3 100644 --- a/product/ERP5Type/id_as_reference.py +++ b/product/ERP5Type/id_as_reference.py @@ -31,6 +31,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet from Products.CMFActivity.Errors import ActivityPendingError from zLOG import LOG, WARNING +from Acquisition import aq_base def IdAsReferenceMixin(suffix): suffix_index = - len(suffix) @@ -71,6 +72,9 @@ def IdAsReferenceMixin(suffix): id = self.id if id[suffix_index:] == suffix: return id[:suffix_index] - return self._baseGetReference(*args) + try: + return self._baseGetReference(*args) + except AttributeError: + return getattr(aq_base(self), 'default_reference', (args or [None])[0]) return IdAsReferenceMixin