Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
Commits
9157b3cd
Commit
9157b3cd
authored
Oct 02, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Worklist.py: deploy worklist variable to support dynamic variable.
parent
ad093324
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
16 deletions
+46
-16
product/ERP5Workflow/Document/Worklist.py
product/ERP5Workflow/Document/Worklist.py
+46
-16
No files found.
product/ERP5Workflow/Document/Worklist.py
View file @
9157b3cd
...
@@ -110,10 +110,29 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
...
@@ -110,10 +110,29 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
return res
return res
def updateDynamicVariable(self):
def updateDynamicVariable(self):
# keep worklist variables updating, correspond to workflow variables.
# Keep worklist variables updating, correspond to workflow variables.
# In the new workflow, we may not need this function for the moment.
res = []
res = []
for worklist_variable_value in self.objectValues():
res.append(worklist_variable_value)
return res
def _updateDynamicVariable(self):
# Keep worklist variables updating, correspond to workflow variables.
# In the new workflow, we may not need this function for the moment.
res = []
workflow_variable_id_list = []
"""
This step serves as the for_catalog function in DC Workflow:
Whenever the for_catalog is 1 in workflow variable, we can configurate
the value of this variable in worklist'
s
automatic
created
sub
-
variable
.
But
it
may
create
too
many
sub
object
in
worklist
.
"""
for variable_value in self.getParentValue().objectValues(portal_type="Variable"):
for variable_value in self.getParentValue().objectValues(portal_type="Variable"):
variable_id = variable_value.getId()
variable_id = variable_value.getId()
workflow_variable_id_list.append(variable_id)
worklist_variable_value = self._getOb(variable_id, None)
worklist_variable_value = self._getOb(variable_id, None)
if worklist_variable_value is None and variable_value.for_catalog == 1:
if worklist_variable_value is None and variable_value.for_catalog == 1:
variable_value_ref = variable_value.getReference()
variable_value_ref = variable_value.getReference()
...
@@ -125,9 +144,15 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
...
@@ -125,9 +144,15 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
elif worklist_variable_value not in res and variable_value.for_catalog == 1:
elif worklist_variable_value not in res and variable_value.for_catalog == 1:
res.append(worklist_variable_value)
res.append(worklist_variable_value)
if worklist_variable_value in res and variable_value.for_catalog == 0:
if worklist_variable_value in res and variable_value.for_catalog == 0:
res.remove(worklist_variable_value)
self._delObject(variable_id)
self._delObject(variable_id)
res.remove(worklist_variable_value)
"""
Append
user
created
worklist
variables
.
"""
for worklist_variable_value in self.objectValues():
if worklist_variable_value.getId() not in workflow_variable_id_list:
res.append(worklist_variable_value)
return res
return res
def getVarMatchKeys(self):
def getVarMatchKeys(self):
...
@@ -140,6 +165,8 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
...
@@ -140,6 +165,8 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
key_list.append('validation_state')
key_list.append('validation_state')
if self.getMatchedCausalityState() is not None:
if self.getMatchedCausalityState() is not None:
key_list.append('causality_state')
key_list.append('causality_state')
for dynamic_variable in self.objectValues():
key_list.append(dynamic_variable.getId())
return key_list
return key_list
def getVarMatch(self, id):
def getVarMatch(self, id):
...
@@ -150,7 +177,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
...
@@ -150,7 +177,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
v = self.getMatchedPortalTypeList()
v = self.getMatchedPortalTypeList()
if v is not None:
if v is not None:
matches = tuple(v)
matches = tuple(v)
if id in ['
validation_state
', '
simulation_state
']:
el
if id in ['validation_state', 'simulation_state']:
if id == 'validation_state':
if id == 'validation_state':
matches_id_list = self.getMatchedValidationStateList()
matches_id_list = self.getMatchedValidationStateList()
elif id == 'simulation_state':
elif id == 'simulation_state':
...
@@ -159,12 +186,19 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
...
@@ -159,12 +186,19 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
if hasattr(self.getParent(), state_id):
if hasattr(self.getParent(), state_id):
matches_ref_list.append(self.getParent()._getOb(state_id).getReference())
matches_ref_list.append(self.getParent()._getOb(state_id).getReference())
matches = tuple(matches_ref_list)
matches = tuple(matches_ref_list)
if id == '
causality_state
':
el
if id == 'causality_state':
matches_id = self.getMatchedCausalityState()
matches_id = self.getMatchedCausalityState()
if matches_id is None:
if matches_id is None:
matches_id = ''
matches_id = ''
matches_ref_list.append(matches_id)
matches_ref_list.append(matches_id)
matches = tuple(matches_ref_list)
matches = tuple(matches_ref_list)
else:
# local dynamic variable
matched_value = self._getOb(id).getInitialValue()
if self._getOb(id).getDefaultExpr() is not None:
matched_value = self._getOb(id).getDefaultExpr()
matches_ref_list.append(matched_value)
matches = tuple(matches_ref_list)
if matches is not [] and matches is not None:
if matches is not [] and matches is not None:
if not isinstance(matches, (tuple, Expression)):
if not isinstance(matches, (tuple, Expression)):
...
@@ -202,24 +236,20 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
...
@@ -202,24 +236,20 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
elif k == 'guard_roles':
elif k == 'guard_roles':
r = [ var.strip() for var in v.split(';') ]
r = [ var.strip() for var in v.split(';') ]
self.setRoleList(r)
self.setRoleList(r)
# Add dynamic variable as worklist sub-object
elif k.startswith('variable_'):
elif k.startswith('variable_'):
# remove prefix from variable id;
# remove prefix from variable id;
worklist_
variable_value_ref = '
_
'.join(k.split('
_
')[1:])
variable_value_ref = '_'.join(k.split('_')[1:])
worklist_variable_value = self.newContent(id=k, portal_type='
Worklist
Variable
')
# Add a local worklist variable:
worklist_variable_value.setReference(k
)
variable_value = self.newContent(portal_type='Worklist Variable'
)
LOG(" add worklist variable '
%
s
' to support dynamic variable"%worklist_variable_value.getId(),0," in Worklist.py"
)
variable_value.setReference(variable_value_ref
)
if tales_re.match(v).group(1):
if tales_re.match(v).group(1):
# Found a TALES prefix
# Found a TALES prefix
worklist_
variable_value.setDefaultExpr(v)
variable_value.setDefaultExpr(v)
else:
else:
worklist_variable_value.setInitialValue(v)
variable_value.setInitialValue(v)
self.actbox_name = str(actbox_name)
self.actbox_name = str(actbox_name)
self.actbox_url = str(actbox_url)
self.actbox_url = str(actbox_url)
self.actbox_category = str(actbox_category)
self.actbox_category = str(actbox_category)
self.actbox_icon = str(actbox_icon)
self.actbox_icon = str(actbox_icon)
g = Guard()
self.guard = self.getGuard()
if g.changeFromProperties(props or REQUEST):
self.guard = g
else:
self.guard = None
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment