diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index eb6fc96f10db87978daf15e414c81cfc8c1b8fec..bbc234d084379decdc7cc55ec5454815b56f5777 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -3131,12 +3131,16 @@ class Base( CopyContainer, """ Returns the creation date of the document based on workflow information """ + if getattr(self, '_creation_date', None) is not None: + return DateTime(self._creation_date) + # Check if edit_workflow defined portal_workflow = self.getPortalObject().portal_workflow wf = portal_workflow.getWorkflowById('edit_workflow') wf_list = portal_workflow.getWorkflowsFor(self) if wf is not None: wf_list = [wf] + wf_list + result = None for wf in wf_list: try: history = wf.getInfoFor(self, 'history', None) @@ -3144,9 +3148,13 @@ class Base( CopyContainer, history = None if history is not None and len(history): # Then get the first line of edit_workflow - return history[0].get('time', None) - if getattr(aq_base(self), 'CreationDate', None) is not None: - return asDate(self.CreationDate()) + result = history[0].get('time', None) + if result is None: + if getattr(aq_base(self), 'CreationDate', None) is not None: + result = asDate(self.CreationDate()) + if result is not None: + self._creation_date = DateTime(result) + return result return None # JPS-XXX - try to find a way to return a creation date instead of None security.declareProtected(Permissions.AccessContentsInformation, 'getModificationDate')