Commit e48a89dc authored by Arnaud Fontaine's avatar Arnaud Fontaine

Do not reset Components on ComponentTool _setObject and _delObject.

The only purpose of having Interaction Workflow defined on ComponentTool
_setObject and _delObject was for BusinessTemplate installation and
uninstallation, however the reset was also triggered when a new draft
Component was being added. Instead, perform the reset in BusinessTemplate
DocumentTemplateItem.
parent 97ba45fb
......@@ -3561,6 +3561,12 @@ class FilesystemToZodbTemplateItem(FilesystemDocumentTemplateItem,
return FilesystemDocumentTemplateItem._importFile(self, file_name,
*args, **kw)
def afterUninstall(self, already_migrated=False):
"""
Hook called after uninstall
"""
pass
def uninstall(self, *args, **kw):
# Only for uninstall, the path of objects can be given as a
# parameter, otherwise it fallbacks on '_archive'
......@@ -3570,10 +3576,13 @@ class FilesystemToZodbTemplateItem(FilesystemDocumentTemplateItem,
else:
object_keys = self._archive.keys()
if self._is_already_migrated(object_keys):
return ObjectTemplateItem.uninstall(self, *args, **kw)
already_migrated = self._is_already_migrated(object_keys)
if already_migrated:
ObjectTemplateItem.uninstall(self, *args, **kw)
else:
return FilesystemDocumentTemplateItem.uninstall(self, *args, **kw)
FilesystemDocumentTemplateItem.uninstall(self, *args, **kw)
self.afterUninstall(already_migrated)
def remove(self, context, **kw):
"""
......@@ -3874,9 +3883,14 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem):
self._objects or self._archive))
if self._is_already_migrated(object_list):
return ObjectTemplateItem.install(self, context, **kw)
ObjectTemplateItem.install(self, context, **kw)
self.portal_components.reset(force=True, reset_portal_type=True)
else:
return FilesystemDocumentTemplateItem.install(self, context, **kw)
FilesystemDocumentTemplateItem.install(self, context, **kw)
def afterUninstall(self, already_migrated=False):
if already_migrated:
self.portal_components.reset(force=True, reset_portal_type=True)
from Products.ERP5Type.Core.ExtensionComponent import ExtensionComponent as \
ExtensionComponentDocument
......
......@@ -71,10 +71,6 @@
<type>Category Tool</type>
<workflow>dynamic_class_generation_interaction_workflow</workflow>
</chain>
<chain>
<type>Component Tool</type>
<workflow>dynamic_class_generation_interaction_workflow</workflow>
</chain>
<chain>
<type>Content Existence Constraint</type>
<workflow>dynamic_class_generation_interaction_workflow</workflow>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<list>
<string>ComponentTool_reset</string>
</list>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>When a Component is deleted or added in Component Tool, reset all Components</string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComponentTool_reset</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>_delObject</string>
<string>_setObject</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Component Tool</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2012-02-29 arnaud.fontaine
* Do not reset Components on ComponentTool _setObject and _delObject, instead reset in BusinessTemplate to avoid reset being triggered when a new Component is created.
2012-02-28 arnaud.fontaine
* Rename version_priority ERP5Site property to version_priority_list.
......
41015
\ No newline at end of file
41016
\ No newline at end of file
......@@ -19,7 +19,6 @@ Category Related Membership Arity Constraint | dynamic_class_generation_interact
Category Related Membership State Constraint | dynamic_class_generation_interaction_workflow
Category Tool | dynamic_class_generation_interaction_workflow
Category | edit_workflow
Component Tool | dynamic_class_generation_interaction_workflow
Content Existence Constraint | dynamic_class_generation_interaction_workflow
Distributed Ram Cache | distributed_ram_cache_interaction_workflow
Document Component | component_validation_workflow
......
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