Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
1aedf2a9
Commit
1aedf2a9
authored
Jul 26, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: add 2 functions allowCreate and getCatalogVariablesFor.
parent
d845c2b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+41
-0
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
1aedf2a9
...
...
@@ -1047,6 +1047,47 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
self
.
updateRoleMappingsFor
(
ob
)
return
new_sdef
security
.
declarePrivate
(
'allowCreate'
)
def
allowCreate
(
self
,
container
,
type_name
):
"""Returns true if the user is allowed to create a workflow instance.
The object passed to the guard is the prospective container.
wenjie: This is a compatibility related patch.
More detail see TypeTool.pyline 360.
"""
return
1
security
.
declarePrivate
(
'getCatalogVariablesFor'
)
def
getCatalogVariablesFor
(
self
,
ob
):
'''
Allows this workflow to make workflow-specific variables
available to the catalog, making it possible to implement
worklists in a simple way.
Returns a mapping containing the catalog variables
that apply to ob.
'''
res
=
{}
status
=
self
.
_getStatusOf
(
ob
)
for
id
,
vdef
in
self
.
getVariableValueList
():
if
vdef
.
for_catalog
:
if
status
.
has_key
(
id
):
value
=
status
[
id
]
# Not set yet. Use a default.
elif
vdef
.
default_expr
is
not
None
:
ec
=
createExprContext
(
StateChangeInfo
(
ob
,
self
,
status
))
value
=
vdef
.
default_expr
(
ec
)
else
:
value
=
vdef
.
default_value
res
[
id
]
=
value
# Always provide the state variable.
state_var
=
self
.
state_var
res
[
state_var
]
=
status
.
get
(
state_var
,
self
.
initial_state
)
return
res
def
Guard_checkWithoutRoles
(
self
,
sm
,
wf_def
,
ob
,
**
kw
):
"""Checks conditions in this guard.
This function is the same as Guard.check, but roles are not taken
...
...
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