Commit 5d146be5 authored by Ivan Tyagov's avatar Ivan Tyagov

Do not reset Person object reference when installing from business template (Bug #561)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12642 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1f6ce553
...@@ -71,8 +71,11 @@ ...@@ -71,8 +71,11 @@
<value> <string>"""Hook called when a person object is closed.\n <value> <string>"""Hook called when a person object is closed.\n
\n \n
We want to reset the reference, which is the user login in ERP5Security.\n We want to reset the reference, which is the user login in ERP5Security.\n
One exception is when a person object is installed from business template.\n
"""\n """\n
context.setReference(None)\n is_business_template_installation = context.REQUEST.get(\'is_business_template_installation\', 0)\n
if not is_business_template_installation:\n
context.setReference(None)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -131,6 +134,7 @@ context.setReference(None)\n ...@@ -131,6 +134,7 @@ context.setReference(None)\n
<tuple> <tuple>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>is_business_template_installation</string>
<string>None</string> <string>None</string>
</tuple> </tuple>
</value> </value>
......
...@@ -652,6 +652,9 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -652,6 +652,9 @@ class ObjectTemplateItem(BaseTemplateItem):
obj = obj._getCopy(container) obj = obj._getCopy(container)
container._setObject(object_id, obj) container._setObject(object_id, obj)
obj = container._getOb(object_id) obj = container._getOb(object_id)
# mark a business template installation so in 'PortalType_afterClone' scripts
# we can implement logical for reseting or not attributes (i.e reference).
self.REQUEST.set('is_business_template_installation', 1)
obj.manage_afterClone(obj) obj.manage_afterClone(obj)
obj.wl_clearLocks() obj.wl_clearLocks()
# if portal types upgrade, set backup properties # if portal types upgrade, set backup properties
......
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