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
Hamza
erp5
Commits
75853952
Commit
75853952
authored
Jun 30, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: pass comment as a kw to make transition comment work.
parent
0a73ea28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+19
-13
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
75853952
...
...
@@ -278,8 +278,13 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
return
sorted
(
self
.
getPortalObject
().
getDefaultModule
(
'acl_users'
).
valid_roles
())
security
.
declarePrivate
(
'doActionFor'
)
def
doActionFor
(
self
,
document
,
action
,
*
args
,
**
kw
):
def
doActionFor
(
self
,
document
,
action
,
comment
=
''
,
**
kw
):
'''
Allows the user to request a workflow action. This method
must perform its own security checks.
'''
sdef
=
self
.
_getWorkflowStateOf
(
document
,
id_only
=
0
)
kw
[
'comment'
]
=
comment
if
sdef
is
None
:
raise
WorkflowException
(
_
(
u'Object is in an undefined state.'
))
if
self
.
isActionSupported
(
document
,
action
,
**
kw
):
...
...
@@ -297,7 +302,7 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
raise
WorkflowException
(
msg
)
if
not
self
.
_checkTransitionGuard
(
tdef
,
document
,
**
kw
):
raise
Unauthorized
(
action
)
self
.
_changeStateOf
(
document
,
tdef
)
self
.
_changeStateOf
(
document
,
tdef
,
kw
)
def
_changeStateOf
(
self
,
document
,
tdef
=
None
,
kwargs
=
None
):
'''
...
...
@@ -642,11 +647,18 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
state_values
=
{}
if
state_values
is
None
:
state_values
=
{}
tdef_exprs
=
None
tdef_exprs
=
{}
if
tdef
is
not
None
:
tdef_exprs
=
tdef
.
objectValues
(
portal_type
=
'Variable'
)
if
tdef_exprs
is
None
:
tdef_exprs
=
{}
transition_variable_list
=
tdef
.
objectValues
(
portal_type
=
'Transition Variable'
)
for
transition_variable
in
transition_variable_list
:
tdef_exprs
[
transition_variable
.
getCausalityId
()]
=
transition_variable
.
getDefaultExpr
()
if
tdef_exprs
[
transition_variable
.
getCausalityId
()]
is
None
:
tdef_exprs
[
transition_variable
.
getCausalityId
()]
=
self
.
_getOb
(
transition_variable
.
getCausalityId
()).
getDefaultExpr
()
# Update all transition variables
if
form_kw
is
not
None
:
object
.
REQUEST
.
other
.
update
(
form_kw
)
kwargs
=
form_kw
for
vdef
in
self
.
objectValues
(
portal_type
=
'Variable'
):
id
=
vdef
.
getId
()
id_no_suffix
=
vdef
.
getReference
()
...
...
@@ -657,9 +669,9 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
value
=
state_values
[
id_no_suffix
]
elif
id
in
tdef_exprs
:
expr
=
tdef_exprs
[
id
]
elif
not
vdef
.
update_always
and
id
in
former_status
:
elif
not
vdef
.
update_always
and
id
_no_suffix
in
former_status
:
# Preserve former value
value
=
former_status
[
id
]
value
=
former_status
[
id
_no_suffix
]
else
:
if
vdef
.
getDefaultExpr
()
is
not
None
:
expr
=
vdef
.
getDefaultExpr
()
...
...
@@ -695,12 +707,6 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
# update state
status_dict
[
state_var
]
=
new_state
object
=
self
.
getStateChangeInformation
(
document
,
current_state_value
,
transition
=
self
)
# Update all transition variables
if
form_kw
is
not
None
:
object
.
REQUEST
.
other
.
update
(
form_kw
)
for
variable
in
self
.
objectValues
(
portal_type
=
'Transition Variable'
):
status_dict
[
variable
.
getCausalityTitle
()]
=
variable
.
getInitialValue
(
object
=
object
)
tool
.
setStatusOf
(
self
.
getReference
(),
document
,
status_dict
)
self
.
updateRoleMappingsFor
(
document
)
...
...
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