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 @@
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
<value> <string>Transition_init</string> </value>
</item>
<item>
<key> <string>permission</string> </key>
......
......@@ -103,7 +103,6 @@
<string>my_id</string>
<string>my_title</string>
<string>my_reference</string>
<string>my_callable_type</string>
<string>my_portal_type</string>
</list>
</value>
......
"""
Set up an Workflow with defaults variables needed by ERP5
"""
for state_id, state_title in (('draft', 'Draft'),):
state = context.newContent(portal_type='State')
state.setReference(state_id)
state.setTitle(state_title)
state = context.newContent(portal_type='State', reference='draft', title='Draft')
context.setSourceValue(state)
for v, property_dict in (
('action', {
'description': 'Transition id',
'variable_default_expression': 'transition/getReference|nothing',
'for_catalog': 0,
'for_status': 1,
'automatic_update': 1,
}),
('actor', {
'description': 'Name of the user who performed transition',
'variable_default_expression': 'user/getIdOrUserName',
'for_catalog': 0,
'for_status': 1,
'automatic_update': 1,
}),
('comment', {
'description': 'Comment about transition',
'variable_default_expression': "python:state_change.kwargs.get('comment', '')",
'for_catalog': 0,
'for_status': 1,
'automatic_update': 1,
}),
('history', {
'description': 'Provides access to workflow history',
'for_catalog': 0,
'variable_default_expression': 'state_change/getHistory',
}),
('time', {
'description': 'Transition timestamp',
'variable_default_expression': 'state_change/getDateTime',
'for_catalog': 0,
'for_status': 1,
'automatic_update': 1,
}),
('error_message', {
'description': 'Error message if validation failed',
'for_catalog': 0,
'for_status': 1,
'automatic_update': 1,
}),
......
......@@ -78,7 +78,12 @@
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
<list>
<string>listbox_for_catalog</string>
<string>listbox_automatic_update</string>
<string>listbox_title</string>
<string>listbox_reference</string>
</list>
</value>
</item>
<item>
......
......@@ -118,6 +118,18 @@
<string>title</string>
<string>Title</string>
</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>
</value>
</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 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_callable_type</string> </value>
<value> <string>listbox_for_catalog</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -26,6 +18,10 @@
<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>
......@@ -34,15 +30,47 @@
<value>
<dictionary>
<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>
</item>
<item>
<key> <string>form_id</string> </key>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</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>
</item>
</dictionary>
......@@ -53,15 +81,47 @@
<value>
<dictionary>
<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>form_id</string> </key>
<key> <string>default</string> </key>
<value> <string></string> </value>
</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>
</item>
</dictionary>
......@@ -72,20 +132,48 @@
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_category</string> </value>
<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>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Callable Type</string> </value>
<value> <string>listbox_for_catalog</string> </value>
</item>
</dictionary>
</value>
......
......@@ -49,7 +49,7 @@
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: \'state\'</string> </value>
<value> <string>python: \'simulation_state\'</string> </value>
</item>
<item>
<key> <string>storage_id</string> </key>
......
......@@ -75,7 +75,7 @@
</item>
<item>
<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>
<key> <string>select_variable</string> </key>
......
......@@ -100,8 +100,28 @@ class TypesTool(TypeProvider):
security = ClassSecurityInfo()
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):
if not self.has_key('Interaction Workflow'):
if [x for x in self._bootstrap_type_list if not self.has_key(x)]:
return True
# bootstrap is not required, but we may have a few bugfixes to apply
# so that the user can upgrade Business Templates
......@@ -128,24 +148,10 @@ class TypesTool(TypeProvider):
def _bootstrap(self):
from Products.ERP5.ERP5Site import ERP5Generator
ERP5Generator.bootstrap(self, 'erp5_core', 'PortalTypeTemplateItem', (
'Business Template',
'Standard Property',
'Acquired Property',
# 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(self,
'erp5_core',
'PortalTypeTemplateItem',
self._bootstrap_type_list)
ERP5Generator.bootstrap_allow_type(self, 'Catalog Tool')
ERP5Generator.bootstrap_allow_type(self, 'Workflow')
ERP5Generator.bootstrap_allow_type(self, 'Interaction Workflow')
......
......@@ -944,7 +944,6 @@ def convertToERP5Workflow(self, temp_object=False):
workflow_script.setReference(script.id)
workflow_script.setTitle(script.title)
workflow_script.setParameterSignature(script._params)
#workflow_script.setCallableType(script.callable_type)# not defined in python script?
workflow_script.setBody(script._body)
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