[Erp5-dev] Username lost when installing a Person object from bt5 file
Ivan Tyagov
ivan at nexedi.com
Tue Jan 9 08:18:47 CET 2007
Jérôme Perrin wrote:
> Le Lundi 08 Janvier 2007 13:52, Yoshinori Okuji a écrit :
>> The first question is whether it is required to call manager_afterClone for
>> an object copied from a business template. I guess this is not necessary.
>> If I am correct, you can simply remove the calling. But I may be wrong.
>
> Maybe we only need to call reindexObject.
We can not safely remove 'manage_afterClone()'. This can have a lot of
unexpected behavior for different portal types.
'reindexObject()' anyway will be called (at least that I observed) for
every object installed from bt file.
>> If you cannot remove it, we need a way to bypass reseting properties (i.e.
>> not to call a script specified by a portal type), by passing a parameter to
>> the method, for example.
>
> manage_afterClone on objects created by business template is a general
> problem, because it will delete workflow_history attribute, thus reset all
> workflow states for the object.
That's correct and it's one of the reasons I think we shouldn't remove
the call to it.
The main problem in finding a general solution is that there's a
difference between creating an object from scratch (i.e. using UI or by
script) and creating an object out of a business template. This
difference becomes apparent for mentioned use-case ('Person' object).
And unfortunately 'manage_afterClone()' is not aware of that fact.
One way is to pass another generic argument to it indicating that we're
installing the object out of a template. This argument will be passed to
the responsible portal_type script which for Person is
'Person_afterClone' and in this method we can implement specific logic.
Ivan
More information about the Erp5-dev
mailing list