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
Labels
Merge Requests
137
Merge Requests
137
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
f2cd97eb
Commit
f2cd97eb
authored
May 12, 2023
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph_editor: Support translation.
parent
5e2b3bbd
Pipeline
#28022
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/Workflow_getGraph.py
...eItem/portal_skins/erp5_graph_editor/Workflow_getGraph.py
+14
-2
No files found.
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/Workflow_getGraph.py
View file @
f2cd97eb
import
json
from
Products.ERP5Type.Utils
import
getTranslationStringWithContext
# TODO:
# select after script in edge properties
# checked box for validation ? or at least select before script
def
getWorkflowGraph
(
workflow
):
workflow_id
=
workflow
.
getId
()
graph
=
{
'node'
:
{},
'edge'
:
{}}
for
state
in
workflow
.
getStateValueList
():
is_initial_state
=
state
.
getId
()
==
workflow
.
getSourceId
()
transition_list
=
[]
state_name
=
state
.
getId
()
state_title
=
state
.
getTitle
()
if
state_title
:
translated_state_title
=
getTranslationStringWithContext
(
context
,
state_title
,
'state'
,
workflow_id
)
if
translated_state_title
:
state_name
=
translated_state_title
graph
[
'node'
][
state
.
getId
()]
=
{
'_class'
:
'workflow.state'
,
'name'
:
state
.
getTitleOrId
()
,
'name'
:
state
_name
,
'is_initial_state'
:
is_initial_state
,
'path'
:
state
.
getPath
()
}
...
...
@@ -20,11 +28,15 @@ def getWorkflowGraph(workflow):
transition_id
=
transition
.
getReference
()
if
transition_id
in
workflow
.
getTransitionReferenceList
():
if
transition
.
getDestinationId
():
transition_name
=
transition
.
getActionName
()
or
transition
.
getTitleOrId
()
translated_transition_name
=
getTranslationStringWithContext
(
context
,
transition_name
,
'transition'
,
workflow_id
)
if
translated_transition_name
:
transition_name
=
translated_transition_name
graph
[
'edge'
][
"%s_%s"
%
(
state
.
getId
(),
transition
.
getId
())]
=
({
'_class'
:
'workflow.transition'
,
'source'
:
state
.
getId
(),
'destination'
:
transition
.
getDestinationId
(),
'name'
:
transition
.
getActionName
()
or
transition
.
getTitleOrId
()
,
'name'
:
transition
_name
,
'description'
:
transition
.
getDescription
(),
'actbox_url'
:
transition
.
getAction
(),
'transition_id'
:
transition
.
getId
(),
# used for edition.
...
...
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