Commit fb2ad729 authored by wenjie.zheng's avatar wenjie.zheng

WorkflowTool.py: convertt dynamic variable during worklist conversion if need;...

WorkflowTool.py: convertt dynamic variable during worklist conversion if need; check new dynamic variable value by using it's reference.
parent 9157b3cd
......@@ -56,6 +56,7 @@ from Products.CMFCore.WorkflowTool import WorkflowTool as OriginalWorkflowTool
from Products.CMFCore.WorkflowCore import ObjectMoved, ObjectDeleted,\
WorkflowException
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
from Products.DCWorkflow.Expression import Expression
from Products.DCWorkflow.Transitions import TRIGGER_WORKFLOW_METHOD
from Products.ERP5 import _dtmldir
from Products.ERP5.Document.BusinessTemplate import BusinessTemplateMissingDependency
......@@ -397,6 +398,14 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
for value in values:
state_id = value
worklist.setMatchedCausalityState(state_id)
else:
# dynamic variable.
worklist_variable_value = worklist.newContent(portal_type='Worklist Variable')
worklist_variable_value.setReference(key)
if isinstance(values, Expression):
worklist_variable_value.setDefaultExpr(values.text)
else:
worklist_variable_value.InitialValue(value)
worklist.setActboxUrl(qdef.actbox_url)
worklist.setActboxCategory(qdef.actbox_category)
worklist.setActboxIcon(qdef.actbox_icon)
......@@ -952,6 +961,8 @@ def getValidCriterionDict(worklist_match_dict, sql_catalog, workflow_worklist_ke
metadata = None
isValidColumn = sql_catalog.isValidColumn
for criterion_id, criterion_value in worklist_match_dict.iteritems():
if criterion_id.startswith('variable_'):
criterion_id = '_'.join(criterion_id.split('_')[1:])
if isValidColumn(criterion_id):
if isinstance(criterion_value, tuple):
criterion_value = list(criterion_value)
......
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