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
Paul Graydon
erp5
Commits
710c74e4
Commit
710c74e4
authored
Jul 30, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: add initialDeafultWorkflow, which is required in creating pre-configured workflow.
parent
638caa0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+53
-0
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
710c74e4
...
...
@@ -1099,6 +1099,59 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
res
[
state_var
]
=
None
return
res
def
initialDefaultWorkflow
(
self
):
"""Sets up an Workflow with defaults variables needed by ERP5.
"""
for
state_id
,
state_title
in
((
'draft'
,
'Draft'
),):
state
=
self
.
newContent
(
portal_type
=
'State'
)
state
.
setReference
(
state_id
)
state
.
setTitle
(
state_title
)
self
.
setSourceValue
(
state
)
for
v
,
property_dict
in
(
(
'action'
,
{
'description'
:
'Transition id'
,
'default_expr'
:
'transition/getReference|nothing'
,
'for_status'
:
1
,
'update_always'
:
1
,
}),
(
'actor'
,
{
'description'
:
'Name of the user who performed transition'
,
'default_expr'
:
'user/getUserName'
,
'for_status'
:
1
,
'update_always'
:
1
,
}),
(
'comment'
,
{
'description'
:
'Comment about transition'
,
'default_expr'
:
"python:state_change.kwargs.get('comment', '')"
,
'for_status'
:
1
,
'update_always'
:
1
,
}),
(
'history'
,
{
'description'
:
'Provides access to workflow history'
,
'default_expr'
:
'state_change/getHistory'
,
}),
(
'time'
,
{
'description'
:
'Transition timestamp'
,
'default_expr'
:
'state_change/getDateTime'
,
'for_status'
:
1
,
'update_always'
:
1
,
}),
(
'error_message'
,
{
'description'
:
'Error message if validation failed'
,
'for_status'
:
1
,
'update_always'
:
1
,
}),
(
'portal_type'
,
{
'description'
:
'Portal type (used as filter for worklists)'
,
'for_catalog'
:
1
,
}),
):
variable
=
self
.
newContent
(
portal_type
=
'Variable'
)
variable
.
setReference
(
v
)
variable
.
setProperties
(
**
property_dict
)
self
.
setStateVariable
(
'simulation_state'
)
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