diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index ac16e5606c74e5c76deae74816d5215b58670520..1318fbb374e34ab94af67c125ff58c849b80087f 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -834,12 +834,23 @@ class Base( CopyContainer, def _propertyMap(self): """ Method overload - properties are now defined on the ptype """ + # Get all the accessor holders for ZODB Property Sheets + if hasattr(self.__class__, 'getAccessorHolderPropertyList'): + accessor_holder_property_list = \ + tuple(self.__class__.getAccessorHolderPropertyList()) + # Temporary portal type (such as 'TempBase' meaningful to display + # the objects being created/updated/removed on SVN update) does + # not inherit from any class of erp5.portal_type + else: + accessor_holder_property_list = () + self._aq_dynamic('id') # Make sure aq_dynamic has been called once property_holder = Base.aq_portal_type.get(self._aq_key()) if property_holder is None: return ERP5PropertyManager._propertyMap(self) return (tuple(getattr(property_holder, '_properties', ())) + - tuple(getattr(self, '_local_properties', ()))) + tuple(getattr(self, '_local_properties', ())) + + accessor_holder_property_list) def manage_historyCompare(self, rev1, rev2, REQUEST, historyComparisonResults=''): diff --git a/product/ERP5Type/dynamic/lazy_class.py b/product/ERP5Type/dynamic/lazy_class.py index 1bdab4122e308cb18d2dd8b51c418c1ff03717db..f9f62c3b6943672d32f358c101442879b17280c8 100644 --- a/product/ERP5Type/dynamic/lazy_class.py +++ b/product/ERP5Type/dynamic/lazy_class.py @@ -87,6 +87,20 @@ class PortalTypeMetaClass(ExtensionClass): """ return metacls.subclass_register.get(cls, []) + def getAccessorHolderPropertyList(cls): + """ + Get all the properties as defined in the accessor holders, + meaningful for _propertyMap for example + + @see Products.ERP5Type.Base.Base._propertyMap + """ + property_list = [] + for klass in cls.mro(): + if klass.__module__ == 'erp5.accessor_holder': + property_list.extend(klass._properties) + + return property_list + def resetAcquisitionAndSecurity(cls): # First, fill the __get__ slot of the class # that has been null'ed after resetting its __bases__