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
Bryan Kaperick
erp5
Commits
4ddc5d73
Commit
4ddc5d73
authored
Dec 05, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display nodes for all trade states and also for start and end implicit states
parent
8e9c955a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
18 deletions
+35
-18
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/BusinessProcess_getGraph.xml
...rtal_skins/erp5_graph_editor/BusinessProcess_getGraph.xml
+35
-18
No files found.
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/BusinessProcess_getGraph.xml
View file @
4ddc5d73
...
...
@@ -50,38 +50,55 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
import json\n
<value>
<string>
from Products.ERP5Type.Message import translateString\n
import json\n
portal = context.getPortalObject()\n
\n
import json\n
#context.manage_delProperties([\'jsplumb_graph\'])\n
# if a graph has been saved, we use this info for node coordinates.\n
position_graph = context.getProperty(\'jsplumb_graph\')\n
\n
if position_graph:\n
context.log(position_graph)\n
position_graph = json.loads(position_graph)[\'graph\']\n
\n
visited_business_process_set = set() # prevent infinite recurisions\n
\n
def getBusinessProcessGraph(business_process):\n
graph = dict(node=dict(), edge=dict())\n
graph = dict(node=dict(start=dict(_class=\'erp5.business_process.start\',\n
name=str(translateString(\'Start\'))),\n
end=dict(_class=\'erp5.business_process.end\',\n
name=str(translateString(\'End\'))),),\n
edge=dict())\n
\n
\n
for trade_state in portal.portal_categories.trade_state.getCategoryChildValueList(): # XXX all\n
state_id = trade_state.getReference() or trade_state.getId()\n
graph[\'node\'][state_id] = dict(\n
_class=\'erp5.business_process.trade_state\',\n
name=trade_state.getTranslatedTitle())\n
\n
for state_id in graph[\'node\'].keys():\n
if position_graph and state_id in position_graph[\'node\']:\n
graph[\'node\'][state_id][\'coordinate\'] = position_graph[\'node\'][state_id][\'coordinate\']\n
\n
if business_process in visited_business_process_set:\n
return graph\n
visited_business_process_set.add(business_process)\n
for link in business_process.contentValues(portal_type=\'Business Link\'):\n
for trade_state in (link.getPredecessorValue(), link.getSuccessorValue()):\n
if trade_state is not None:\n
state_id = trade_state.getReference() or trade_state.getId()\n
graph[\'node\'][state_id] = dict(\n
_class=\'erp5.business_process.trade_state\',\n
name=trade_state.getTranslatedTitle())\n
if state_id in position_graph[\'node\']:\n
graph[\'node\'][state_id][\'coordinate\'] = position_graph[\'node\'][state_id][\'coordinate\'] \n
if link.getPredecessor() and link.getSuccessor(): # XXX no start ??\n
graph[\'edge\'][link.getRelativeUrl()] = dict(\n
\n
predecessor = \'start\'\n
if link.getPredecessor():\n
predecessor = link.getPredecessorReference() or link.getPredecessorId()\n
successor = \'end\'\n
if link.getSuccessor():\n
successor = link.getSuccessorReference() or link.getSuccessorId()\n
\n
graph[\'edge\'][link.getRelativeUrl()] = dict(\n
_class=\'erp5.business_process.business_link\',\n
source=link.getPredecessorReference() or link.getPredecessorId(),\n
destination=link.getSuccessorReference() or link.getSuccessorId(),\n
name=link.getTranslatedTitle())\n
source=predecessor,\n
destination=successor,\n
name=link.getTranslatedTitle(),\n
business_process_relative_url=context.getRelativeUrl(),\n
trade_phase=link.getTradePhase())\n
\n
for specialise in [context] + business_process.getSpecialiseValueList(portal_type=\'Business Process\'):\n
specialise_graph = getBusinessProcessGraph(specialise)\n
...
...
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