diff --git a/bt5/erp5_workflow/SkinTemplateItem/portal_skins/erp5_workflow/Workflow_init.xml b/bt5/erp5_workflow/SkinTemplateItem/portal_skins/erp5_workflow/Workflow_init.xml index fde51396361c69965edcbba3037a7f8e475f084b..6a650f958da609d90c7d35899789ffeaa006a8bd 100644 --- a/bt5/erp5_workflow/SkinTemplateItem/portal_skins/erp5_workflow/Workflow_init.xml +++ b/bt5/erp5_workflow/SkinTemplateItem/portal_skins/erp5_workflow/Workflow_init.xml @@ -50,7 +50,58 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>context.initialDefaultWorkflow()\n + <value> <string>"""Sets up an Workflow with defaults variables needed by ERP5.\n +"""\n +for state_id, state_title in ((\'draft\', \'Draft\'),):\n + state = context.newContent(portal_type=\'State\')\n + state.setReference(state_id)\n + state.setTitle(state_title)\n +context.setSourceValue(state)\n +\n +for v, property_dict in (\n + (\'action\', {\n + \'description\': \'Transition id\',\n + \'default_expr\': \'transition/getReference|nothing\',\n + \'for_status\': 1,\n + \'automatic_update\': 1,\n + }),\n + (\'actor\', {\n + \'description\': \'Name of the user who performed transition\',\n + \'default_expr\': \'user/getUserName\',\n + \'for_status\': 1,\n + \'automatic_update\': 1,\n + }),\n + (\'comment\', {\n + \'description\': \'Comment about transition\',\n + \'default_expr\': "python:state_change.kwargs.get(\'comment\', \'\')",\n + \'for_status\': 1,\n + \'automatic_update\': 1,\n + }),\n + (\'history\', {\n + \'description\': \'Provides access to workflow history\',\n + \'default_expr\': \'state_change/getHistory\',\n + }),\n + (\'time\', {\n + \'description\': \'Transition timestamp\',\n + \'default_expr\': \'state_change/getDateTime\',\n + \'for_status\': 1,\n + \'automatic_update\': 1,\n + }),\n + (\'error_message\', {\n + \'description\': \'Error message if validation failed\',\n + \'for_status\': 1,\n + \'automatic_update\': 1,\n + }),\n + (\'portal_type\', {\n + \'description\': \'Portal type (used as filter for worklists)\',\n + \'for_catalog\': 1,\n + }),\n + ):\n + variable = context.newContent(portal_type=\'Variable\')\n + variable.setReference(v)\n + variable.edit(**property_dict)\n +\n +context.setStateVariable(\'simulation_state\')\n </string> </value> </item> <item> diff --git a/product/ERP5Workflow/Document/Variable.py b/product/ERP5Workflow/Document/Variable.py index 10a24c38da4d3a4cf729649c89f5391ff4164d6c..f8b9373900283b1211c3881e44e47a930d7ab19f 100644 --- a/product/ERP5Workflow/Document/Variable.py +++ b/product/ERP5Workflow/Document/Variable.py @@ -91,34 +91,11 @@ class Variable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): def getInfoGuard(self): if self.info_guard is not None: - self.generateGuard() + self.generateInfoGuard() return self.info_guard def getInfoGuardSummary(self): res = None if self.info_guard is not None: res = self.info_guard.getSummary() - return res - - # initial pre-configured workflow's variables - def setProperties(self, description, - default_value='', default_expr='', - for_catalog=0, for_status=0, - update_always=0, - props=None, REQUEST=None): - self.setDescription(str(description)) - self.setInitialValue(str(default_value)) - if default_expr: - self.setDefaultExpr(default_expr) - else: - self.default_expr = None - g = Guard() - if g.changeFromProperties(props or REQUEST): - self.info_guard = g - else: - self.info_guard = None - self.setForCatalog(bool(for_catalog)) - self.setForStatus(bool(for_status)) - self.setAutomaticUpdate(bool(update_always)) - if REQUEST is not None: - return self.manage_properties(REQUEST, 'Properties changed.') + return res \ No newline at end of file