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
Carlos Ramos Carreño
erp5
Commits
d2ab3b09
Commit
d2ab3b09
authored
Apr 30, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transition.py: deploy new id_as_reference; remove prefix to generate good workflow history.
parent
d143fe28
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
product/ERP5Workflow/Document/Transition.py
product/ERP5Workflow/Document/Transition.py
+9
-6
No files found.
product/ERP5Workflow/Document/Transition.py
View file @
d2ab3b09
...
@@ -50,7 +50,7 @@ TRIGGER_AUTOMATIC = 0
...
@@ -50,7 +50,7 @@ TRIGGER_AUTOMATIC = 0
TRIGGER_USER_ACTION
=
1
TRIGGER_USER_ACTION
=
1
TRIGGER_WORKFLOW_METHOD
=
2
TRIGGER_WORKFLOW_METHOD
=
2
class
Transition
(
IdAsReferenceMixin
(
'_transition'
),
XMLObject
):
class
Transition
(
IdAsReferenceMixin
(
"transition_"
,
"prefix"
),
XMLObject
):
"""
"""
A ERP5 Transition.
A ERP5 Transition.
"""
"""
...
@@ -190,7 +190,7 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -190,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
(
'_'
.
join
(
workflow
.
getId
().
split
(
'_'
)[:
-
1
]
),
document
,
status_dict
)
tool
.
setStatusOf
(
workflow
.
getReference
(
),
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
...
@@ -210,7 +210,7 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -210,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
]
=
'_'
.
join
(
new_state
.
split
(
'_'
)[
:
-
1
])
# remove suffix
status_dict
[
state_var
]
=
'_'
.
join
(
new_state
.
split
(
'_'
)[
1
:])
object
=
workflow
.
getStateChangeInformation
(
document
,
state_object
,
transition
=
self
)
object
=
workflow
.
getStateChangeInformation
(
document
,
state_object
,
transition
=
self
)
# update variables =========================================================
# update variables =========================================================
...
@@ -227,7 +227,7 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -227,7 +227,7 @@ 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
])
id_no_suffix
=
'_'
.
join
(
id
.
split
(
'_'
)[
1
:
])
if
vdef
.
for_status
==
0
:
if
vdef
.
for_status
==
0
:
continue
continue
expr
=
None
expr
=
None
...
@@ -255,6 +255,9 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -255,6 +255,9 @@ 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
)
if
id_no_suffix
==
"action"
:
status_dict
[
id_no_suffix
]
=
'_'
.
join
(
value
.
split
(
'_'
)[
1
:])
else
:
status_dict
[
id_no_suffix
]
=
value
status_dict
[
id_no_suffix
]
=
value
# Update all transition variables
# Update all transition variables
...
@@ -265,7 +268,7 @@ class Transition(IdAsReferenceMixin('_transition'), XMLObject):
...
@@ -265,7 +268,7 @@ 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
(
'_'
.
join
(
workflow
.
getId
().
split
(
'_'
)[:
-
1
]
),
document
,
status_dict
)
tool
.
setStatusOf
(
workflow
.
getReference
(
),
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
)
...
...
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