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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Papa Tamsir Kane
erp5
Commits
ff42a339
Commit
ff42a339
authored
Apr 29, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transition.py: add suffix removement to resolve workflow history generation problem.
parent
8e40911c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
product/ERP5Workflow/Document/Transition.py
product/ERP5Workflow/Document/Transition.py
+9
-7
No files found.
product/ERP5Workflow/Document/Transition.py
View file @
ff42a339
...
@@ -165,6 +165,8 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -165,6 +165,8 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
except
KeyError
:
except
KeyError
:
raise
WorkflowException
(
'Destination state undefined: '
+
new_state
)
raise
WorkflowException
(
'Destination state undefined: '
+
new_state
)
LOG
(
" 168 object '%s' will change from state '%s' to '%s'"
%
(
document
.
getId
(),
old_state
,
new_state
),
WARNING
,
" in Transition.py"
)
# Execute the "before" script.
# Execute the "before" script.
before_script_success
=
1
before_script_success
=
1
script_id
=
self
.
getBeforeScriptId
()
script_id
=
self
.
getBeforeScriptId
()
...
@@ -188,7 +190,7 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -188,7 +190,7 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
# Do not proceed in case of failure of before script
# Do not proceed in case of failure of before script
if
not
before_script_success
:
if
not
before_script_success
:
former_status
=
old_state
# Remain in state
former_status
=
old_state
# Remain in state
tool
.
setStatusOf
(
workflow
.
getId
(
),
document
,
status_dict
)
tool
.
setStatusOf
(
'_'
.
join
(
workflow
.
getId
().
split
(
'_'
)[:
-
1
]
),
document
,
status_dict
)
sci
=
StateChangeInfo
(
sci
=
StateChangeInfo
(
document
,
workflow
,
former_status
,
self
,
old_sdef
,
new_sdef
,
kwargs
)
document
,
workflow
,
former_status
,
self
,
old_sdef
,
new_sdef
,
kwargs
)
# put the error message in the workflow history
# put the error message in the workflow history
...
@@ -208,7 +210,7 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -208,7 +210,7 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
status_dict
[
'undo'
]
=
0
status_dict
[
'undo'
]
=
0
# Modify workflow history
# Modify workflow history
status_dict
[
state_var
]
=
new_state
status_dict
[
state_var
]
=
'_'
.
join
(
new_state
.
split
(
'_'
)[:
-
1
])
# remove suffix
object
=
workflow
.
getStateChangeInformation
(
document
,
state_object
,
transition
=
self
)
object
=
workflow
.
getStateChangeInformation
(
document
,
state_object
,
transition
=
self
)
# update variables =========================================================
# update variables =========================================================
...
@@ -225,11 +227,12 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -225,11 +227,12 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
for
vdef
in
workflow
.
objectValues
(
portal_type
=
'Variable'
):
for
vdef
in
workflow
.
objectValues
(
portal_type
=
'Variable'
):
id
=
vdef
.
getId
()
id
=
vdef
.
getId
()
id_no_suffix
=
'_'
.
join
(
id
.
split
(
'_'
)[:
-
1
])
if
vdef
.
for_status
==
0
:
if
vdef
.
for_status
==
0
:
continue
continue
expr
=
None
expr
=
None
if
id
in
state_values
:
if
id
_no_suffix
in
state_values
:
value
=
state_values
[
id
]
value
=
state_values
[
id
_no_suffix
]
elif
id
in
tdef_exprs
:
elif
id
in
tdef_exprs
:
expr
=
tdef_exprs
[
id
]
expr
=
tdef_exprs
[
id
]
elif
not
vdef
.
update_always
and
id
in
former_status
:
elif
not
vdef
.
update_always
and
id
in
former_status
:
...
@@ -252,7 +255,7 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -252,7 +255,7 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
econtext
=
Expression_createExprContext
(
sci
)
econtext
=
Expression_createExprContext
(
sci
)
expr
=
Expression
(
expr
)
expr
=
Expression
(
expr
)
value
=
expr
(
econtext
)
value
=
expr
(
econtext
)
status_dict
[
id
]
=
value
status_dict
[
id
_no_suffix
]
=
value
# Update all transition variables
# Update all transition variables
if
form_kw
is
not
None
:
if
form_kw
is
not
None
:
...
@@ -262,11 +265,10 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -262,11 +265,10 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
status_dict
[
variable
.
getCausalityTitle
()]
=
variable
.
getInitialValue
(
object
=
object
)
status_dict
[
variable
.
getCausalityTitle
()]
=
variable
.
getInitialValue
(
object
=
object
)
# Generate Workflow History List
# Generate Workflow History List
tool
.
setStatusOf
(
workflow
.
getId
(
),
document
,
status_dict
)
tool
.
setStatusOf
(
'_'
.
join
(
workflow
.
getId
().
split
(
'_'
)[:
-
1
]
),
document
,
status_dict
)
### zwj: update Role mapping, also in Workflow, initialiseDocument()
### zwj: update Role mapping, also in Workflow, initialiseDocument()
workflow
.
updateRoleMappingsFor
(
document
)
workflow
.
updateRoleMappingsFor
(
document
)
# Execute the "after" script.
# Execute the "after" script.
script_id
=
self
.
getAfterScriptId
()
script_id
=
self
.
getAfterScriptId
()
if
script_id
is
not
None
:
if
script_id
is
not
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