From f1599ef5c9a185ba0324725dadf7f8b21b80a6b9 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Tue, 5 Feb 2008 18:17:39 +0000 Subject: [PATCH] Initialize portal type (and aq_dynamic) on objects before setting the local roles and notifying the workflows. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19078 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/ERP5Type.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py index 36264612ac..27dcc1122d 100644 --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -279,6 +279,11 @@ class ERP5TypeInformation( FactoryTypeInformation, # Then keep on the construction process ob = self._constructInstance(container, id, *args, **kw) + # Portal type has to be set before setting other attributes + # in order to initialize aq_dynamic + if hasattr(ob, '_setPortalTypeName'): + ob._setPortalTypeName(self.getId()) + # Only try to assign roles to security groups if some roles are defined # This is an optimisation to prevent defining local roles on subobjects # which acquire their security definition from their parent @@ -287,7 +292,13 @@ class ERP5TypeInformation( FactoryTypeInformation, if len(self._roles): self.updateLocalRolesOnSecurityGroups(ob) - ob = self._finishConstruction(ob) + # notify workflow after generating local roles, in order to prevent + # Unauthorized error on transition's condition + if hasattr(aq_base(ob), 'notifyWorkflowCreated'): + ob.notifyWorkflowCreated() + + # Reindex the object at the end + ob.reindexObject() if self.init_script : # Acquire the init script in the context of this object -- 2.30.9