Commit 0ff01552 authored by Arnaud Fontaine's avatar Arnaud Fontaine

squash! ERP5Workflow: DC Workflows are now ERP5 objects (!1378).

parent 5ebc7691
...@@ -62,9 +62,7 @@ ...@@ -62,9 +62,7 @@
</item> </item>
<item> <item>
<key> <string>init_script</string> </key> <key> <string>init_script</string> </key>
<value> <value> <string>Transition_init</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>permission</string> </key> <key> <string>permission</string> </key>
......
...@@ -103,7 +103,6 @@ ...@@ -103,7 +103,6 @@
<string>my_id</string> <string>my_id</string>
<string>my_title</string> <string>my_title</string>
<string>my_reference</string> <string>my_reference</string>
<string>my_callable_type</string>
<string>my_portal_type</string> <string>my_portal_type</string>
</list> </list>
</value> </value>
......
""" """
Set up an Workflow with defaults variables needed by ERP5 Set up an Workflow with defaults variables needed by ERP5
""" """
for state_id, state_title in (('draft', 'Draft'),): state = context.newContent(portal_type='State', reference='draft', title='Draft')
state = context.newContent(portal_type='State')
state.setReference(state_id)
state.setTitle(state_title)
context.setSourceValue(state) context.setSourceValue(state)
for v, property_dict in ( for v, property_dict in (
('action', { ('action', {
'description': 'Transition id', 'description': 'Transition id',
'variable_default_expression': 'transition/getReference|nothing', 'variable_default_expression': 'transition/getReference|nothing',
'for_catalog': 0,
'for_status': 1, 'for_status': 1,
'automatic_update': 1, 'automatic_update': 1,
}), }),
('actor', { ('actor', {
'description': 'Name of the user who performed transition', 'description': 'Name of the user who performed transition',
'variable_default_expression': 'user/getIdOrUserName', 'variable_default_expression': 'user/getIdOrUserName',
'for_catalog': 0,
'for_status': 1, 'for_status': 1,
'automatic_update': 1, 'automatic_update': 1,
}), }),
('comment', { ('comment', {
'description': 'Comment about transition', 'description': 'Comment about transition',
'variable_default_expression': "python:state_change.kwargs.get('comment', '')", 'variable_default_expression': "python:state_change.kwargs.get('comment', '')",
'for_catalog': 0,
'for_status': 1, 'for_status': 1,
'automatic_update': 1, 'automatic_update': 1,
}), }),
('history', { ('history', {
'description': 'Provides access to workflow history', 'description': 'Provides access to workflow history',
'for_catalog': 0,
'variable_default_expression': 'state_change/getHistory', 'variable_default_expression': 'state_change/getHistory',
}), }),
('time', { ('time', {
'description': 'Transition timestamp', 'description': 'Transition timestamp',
'variable_default_expression': 'state_change/getDateTime', 'variable_default_expression': 'state_change/getDateTime',
'for_catalog': 0,
'for_status': 1, 'for_status': 1,
'automatic_update': 1, 'automatic_update': 1,
}), }),
('error_message', { ('error_message', {
'description': 'Error message if validation failed', 'description': 'Error message if validation failed',
'for_catalog': 0,
'for_status': 1, 'for_status': 1,
'automatic_update': 1, 'automatic_update': 1,
}), }),
......
...@@ -78,7 +78,12 @@ ...@@ -78,7 +78,12 @@
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <value>
<list/> <list>
<string>listbox_for_catalog</string>
<string>listbox_automatic_update</string>
<string>listbox_title</string>
<string>listbox_reference</string>
</list>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -118,6 +118,18 @@ ...@@ -118,6 +118,18 @@
<string>title</string> <string>title</string>
<string>Title</string> <string>Title</string>
</tuple> </tuple>
<tuple>
<string>reference</string>
<string>Reference</string>
</tuple>
<tuple>
<string>automatic_update</string>
<string>Update on every Transition</string>
</tuple>
<tuple>
<string>for_catalog</string>
<string>Available for Catalog</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_automatic_update</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>This field is mandatory.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>listbox_automatic_update</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -2,21 +2,13 @@ ...@@ -2,21 +2,13 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/> <global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_callable_type</string> </value> <value> <string>listbox_for_catalog</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -26,6 +18,10 @@ ...@@ -26,6 +18,10 @@
<key> <string>external_validator_failed</string> </key> <key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value> <value> <string>The input failed the external validator.</string> </value>
</item> </item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>This field is mandatory.</string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -34,15 +30,47 @@ ...@@ -34,15 +30,47 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>extra</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>target</string> </key> <key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -53,15 +81,47 @@ ...@@ -53,15 +81,47 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>target</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -72,20 +132,48 @@ ...@@ -72,20 +132,48 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>alternate_name</string> </key>
<value> <string>my_view_mode_category</string> </value> <value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>hidden</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>target</string> </key> <key> <string>required</string> </key>
<value> <string>Click to edit the target</string> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Callable Type</string> </value> <value> <string>listbox_for_catalog</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</item> </item>
<item> <item>
<key> <string>property_default</string> </key> <key> <string>property_default</string> </key>
<value> <string>python: \'state\'</string> </value> <value> <string>python: \'simulation_state\'</string> </value>
</item> </item>
<item> <item>
<key> <string>storage_id</string> </key> <key> <string>storage_id</string> </key>
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
</item> </item>
<item> <item>
<key> <string>property_default</string> </key> <key> <string>property_default</string> </key>
<value> <string>python: []</string> </value> <value> <string>python: [\'Access contents information\', \'Add portal content\', \'Delete objects\', \'Modify portal content\', \'View\']</string> </value>
</item> </item>
<item> <item>
<key> <string>select_variable</string> </key> <key> <string>select_variable</string> </key>
......
...@@ -100,8 +100,28 @@ class TypesTool(TypeProvider): ...@@ -100,8 +100,28 @@ class TypesTool(TypeProvider):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
_bootstrap_type_list = (
'Business Template',
'Standard Property',
'Acquired Property',
# workflow (initializePortalTypeDynamicWorkflowMethods)
'State',
'Transition',
'Transition Variable',
'Workflow Script',
'Workflow Variable',
'Worklist',
'Workflow',
'Interaction',
'Interaction Workflow',
# the following ones are required to upgrade an existing site
'Category Property',
# the following is needed to bootstrap Catalog Tool and default catalog
'Catalog Tool',
)
def _isBootstrapRequired(self): def _isBootstrapRequired(self):
if not self.has_key('Interaction Workflow'): if [x for x in self._bootstrap_type_list if not self.has_key(x)]:
return True return True
# bootstrap is not required, but we may have a few bugfixes to apply # bootstrap is not required, but we may have a few bugfixes to apply
# so that the user can upgrade Business Templates # so that the user can upgrade Business Templates
...@@ -128,24 +148,10 @@ class TypesTool(TypeProvider): ...@@ -128,24 +148,10 @@ class TypesTool(TypeProvider):
def _bootstrap(self): def _bootstrap(self):
from Products.ERP5.ERP5Site import ERP5Generator from Products.ERP5.ERP5Site import ERP5Generator
ERP5Generator.bootstrap(self, 'erp5_core', 'PortalTypeTemplateItem', ( ERP5Generator.bootstrap(self,
'Business Template', 'erp5_core',
'Standard Property', 'PortalTypeTemplateItem',
'Acquired Property', self._bootstrap_type_list)
# workflow (initializePortalTypeDynamicWorkflowMethods)
'State',
'Transition',
'Workflow Script',
'Workflow Variable',
'Worklist',
'Workflow',
'Interaction',
'Interaction Workflow',
# the following ones are required to upgrade an existing site
'Category Property',
# the following is needed to bootstrap Catalog Tool and default catalog
'Catalog Tool',
))
ERP5Generator.bootstrap_allow_type(self, 'Catalog Tool') ERP5Generator.bootstrap_allow_type(self, 'Catalog Tool')
ERP5Generator.bootstrap_allow_type(self, 'Workflow') ERP5Generator.bootstrap_allow_type(self, 'Workflow')
ERP5Generator.bootstrap_allow_type(self, 'Interaction Workflow') ERP5Generator.bootstrap_allow_type(self, 'Interaction Workflow')
......
...@@ -944,7 +944,6 @@ def convertToERP5Workflow(self, temp_object=False): ...@@ -944,7 +944,6 @@ def convertToERP5Workflow(self, temp_object=False):
workflow_script.setReference(script.id) workflow_script.setReference(script.id)
workflow_script.setTitle(script.title) workflow_script.setTitle(script.title)
workflow_script.setParameterSignature(script._params) workflow_script.setParameterSignature(script._params)
#workflow_script.setCallableType(script.callable_type)# not defined in python script?
workflow_script.setBody(script._body) workflow_script.setBody(script._body)
workflow_script.setProxyRole(script._proxy_roles) workflow_script.setProxyRole(script._proxy_roles)
......
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