Commit 3dbabf8a authored by Julien Muchembled's avatar Julien Muchembled

Revert "Make newContent call _edit sooner (before computing local roles)"

66cb9c96 prevented init scripts to be used to
set default values, so original order of initialization must be reverted.
_edit may also trigger interactions that require workflows to be initialized.

Code simplication is kept, and _edit **kw is now passed to init script as an
alternate way for init scripts to know properties given to newContent.
parent 8c4fb3f8
......@@ -400,9 +400,6 @@ class ERP5TypeInformation(XMLObject,
# in order to initialize aq_dynamic
ob.portal_type = self.getId()
if kw:
ob._edit(force_update=1, **kw)
if compute_local_role:
# Do not reindex object because it's already done by manage_afterAdd
self.updateLocalRolesOnDocument(ob, reindex=False)
......@@ -419,7 +416,11 @@ class ERP5TypeInformation(XMLObject,
init_script = self.getTypeInitScriptId()
if init_script:
# Acquire the init script in the context of this object
getattr(ob, init_script)(created_by_builder=created_by_builder)
getattr(ob, init_script)(created_by_builder=created_by_builder,
if kw:
ob._edit(force_update=1, **kw)
return ob
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment