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
ae542497
Commit
ae542497
authored
May 18, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InteractionWorkflow.py: repare the Interaction problem caused by workflow history.
parent
f08fe30d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
product/ERP5Workflow/Document/InteractionWorkflow.py
product/ERP5Workflow/Document/InteractionWorkflow.py
+15
-13
No files found.
product/ERP5Workflow/Document/InteractionWorkflow.py
View file @
ae542497
...
@@ -210,9 +210,10 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
...
@@ -210,9 +210,10 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
Get the current status dict.
Get the current status dict.
"""
"""
workflow_key
=
self
.
_generateHistoryKey
()
workflow_key
=
self
.
_generateHistoryKey
()
hist
=
document
.
workflow_history
# Copy is requested
# Copy is requested
result
=
document
.
workflow_history
[
workflow_key
][
-
1
].
copy
()
result
=
hist
.
get
(
hist
.
keys
()[
-
1
])
#result = document.workflow_history[workflow_key][-1].copy()
return
result
return
result
security
.
declarePrivate
(
'_generateHistoryKey'
)
security
.
declarePrivate
(
'_generateHistoryKey'
)
...
@@ -220,7 +221,7 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
...
@@ -220,7 +221,7 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
"""
"""
Generate a key used in the workflow history.
Generate a key used in the workflow history.
"""
"""
history_key
=
self
.
unrestrictedTraverse
(
self
.
getRelativeUrl
()).
get
Id
()
history_key
=
self
.
unrestrictedTraverse
(
self
.
getRelativeUrl
()).
get
Reference
()
return
history_key
return
history_key
security
.
declarePrivate
(
'getWorklistVariableMatchDict'
)
security
.
declarePrivate
(
'getWorklistVariableMatchDict'
)
...
@@ -259,6 +260,7 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
...
@@ -259,6 +260,7 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
security
.
declarePrivate
(
'notifyBefore'
)
security
.
declarePrivate
(
'notifyBefore'
)
def
notifyBefore
(
self
,
ob
,
transition_list
,
args
=
None
,
kw
=
None
):
def
notifyBefore
(
self
,
ob
,
transition_list
,
args
=
None
,
kw
=
None
):
status_dict
=
self
.
getCurrentStatusDict
(
ob
)
if
type
(
transition_list
)
in
StringTypes
:
if
type
(
transition_list
)
in
StringTypes
:
return
return
...
@@ -270,16 +272,16 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
...
@@ -270,16 +272,16 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
filtered_transition_list
=
[]
filtered_transition_list
=
[]
for
t_id
in
transition_list
:
for
t_id
in
transition_list
:
tdef
=
self
.
_getOb
(
t_id
)
tdef
=
self
.
_getOb
(
'interaction_'
+
t_id
)
assert
tdef
.
trigger_type
==
TRIGGER_WORKFLOW_METHOD
assert
tdef
.
trigger_type
==
TRIGGER_WORKFLOW_METHOD
filtered_transition_list
.
append
(
tdef
.
getId
())
filtered_transition_list
.
append
(
tdef
.
getId
())
former_status
=
self
.
_getOb
(
status_dict
[
self
.
getStateVariable
()],
None
)
former_status
=
{}
sci
=
StateChangeInfo
(
sci
=
StateChangeInfo
(
ob
,
self
,
former_status
,
tdef
,
None
,
None
,
kwargs
=
kw
)
ob
,
self
,
former_status
,
tdef
,
None
,
None
,
kwargs
=
kw
)
before_script_list
=
[]
before_script_list
=
[]
before_script_list
.
append
(
sel
f
.
getBeforeScriptName
())
before_script_list
.
append
(
tde
f
.
getBeforeScriptName
())
if
before_script_list
!=
[]
and
tdef
.
getBeforeScriptName
()
is
not
None
:
if
before_script_list
!=
[]
and
tdef
.
getBeforeScriptName
()
is
not
None
:
for
script_name
in
before_script_list
:
for
script_name
in
before_script_list
:
script
=
self
.
_getOb
(
script_name
)
script
=
self
.
_getOb
(
script_name
)
...
@@ -301,9 +303,9 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
...
@@ -301,9 +303,9 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
kw
[
'workflow_method_args'
]
=
args
kw
[
'workflow_method_args'
]
=
args
for
t_id
in
transition_list
:
for
t_id
in
transition_list
:
tdef
=
self
.
_getOb
(
t_id
)
tdef
=
self
.
_getOb
(
'interaction_'
+
t_id
)
assert
tdef
.
trigger_type
==
TRIGGER_WORKFLOW_METHOD
assert
tdef
.
trigger_type
==
TRIGGER_WORKFLOW_METHOD
former_status
=
self
.
_getOb
(
status_dict
[
self
.
getStateVariable
()],
None
)
former_status
=
{}
econtext
=
None
econtext
=
None
sci
=
None
sci
=
None
...
@@ -344,17 +346,17 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
...
@@ -344,17 +346,17 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
# Execute the "after" script.
# Execute the "after" script.
after_script_list
=
[]
after_script_list
=
[]
after_script_list
.
append
(
sel
f
.
getAfterScriptName
())
after_script_list
.
append
(
tde
f
.
getAfterScriptName
())
if
after_script_list
!=
[]
and
sel
f
.
getAfterScriptName
()
is
not
None
:
if
after_script_list
!=
[]
and
tde
f
.
getAfterScriptName
()
is
not
None
:
for
script_name
in
after_script_list
:
for
script_name
in
after_script_list
:
script
=
workflow
.
_getOb
(
script_name
)
script
=
self
.
_getOb
(
script_name
)
# Pass lots of info to the script in a single parameter.
# Pass lots of info to the script in a single parameter.
script
.
execute
(
sci
)
# May throw an exception
script
.
execute
(
sci
)
# May throw an exception
# Queue the "Before Commit" scripts
# Queue the "Before Commit" scripts
sm
=
getSecurityManager
()
sm
=
getSecurityManager
()
before_commit_script_list
=
[]
before_commit_script_list
=
[]
before_commit_script_list
.
append
(
sel
f
.
getBeforeCommitScriptName
())
before_commit_script_list
.
append
(
tde
f
.
getBeforeCommitScriptName
())
if
before_commit_script_list
!=
[]
and
tdef
.
getBeforeCommitScriptName
()
is
not
None
:
if
before_commit_script_list
!=
[]
and
tdef
.
getBeforeCommitScriptName
()
is
not
None
:
for
script_name
in
before_commit_script_list
:
for
script_name
in
before_commit_script_list
:
transaction
.
get
().
addBeforeCommitHook
(
tdef
.
_before_commit
,
transaction
.
get
().
addBeforeCommitHook
(
tdef
.
_before_commit
,
...
@@ -365,7 +367,7 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
...
@@ -365,7 +367,7 @@ class InteractionWorkflow(IdAsReferenceMixin("interactionworkflow_", "prefix"),
activity_script_list
.
append
(
tdef
.
getActivateScriptName
())
activity_script_list
.
append
(
tdef
.
getActivateScriptName
())
if
activity_script_list
!=
[]
and
tdef
.
getActivateScriptName
()
is
not
None
:
if
activity_script_list
!=
[]
and
tdef
.
getActivateScriptName
()
is
not
None
:
for
script_name
in
activity_script_list
:
for
script_name
in
activity_script_list
:
workflow
.
activate
(
activity
=
'SQLQueue'
)
\
self
.
activate
(
activity
=
'SQLQueue'
)
\
.
activeScript
(
script_name
,
ob
.
getRelativeUrl
(),
.
activeScript
(
script_name
,
ob
.
getRelativeUrl
(),
status
,
tdef
.
getId
())
status
,
tdef
.
getId
())
...
...
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