Vaibhav (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-process-vda into lp:openerp-web.

Requested reviews:
  OpenERP R&D Web Team (openerp-dev-web)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-process-vda/+merge/76374

Process View Using Dracula graph js library.

You can Check:
Sales > Sales > Sale Orders

then click on `help` image/button next to title of view.


-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-process-vda/+merge/76374
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-process-vda.
=== added directory 'addons/web_process'
=== added file 'addons/web_process/__init__.py'
=== added file 'addons/web_process/__openerp__.py'
--- addons/web_process/__openerp__.py	1970-01-01 00:00:00 +0000
+++ addons/web_process/__openerp__.py	2011-09-21 10:27:28 +0000
@@ -0,0 +1,12 @@
+{
+    "name" : "Process",
+    "version" : "2.0",
+    "depends" : ["web"],
+    "js": [
+        "static/src/js/process.js"
+    ],
+    "css": [
+        "static/src/css/process.css"
+    ],
+    'active': True
+}

=== added directory 'addons/web_process/static'
=== added directory 'addons/web_process/static/src'
=== added directory 'addons/web_process/static/src/css'
=== added file 'addons/web_process/static/src/css/process.css'
--- addons/web_process/static/src/css/process.css	1970-01-01 00:00:00 +0000
+++ addons/web_process/static/src/css/process.css	2011-09-21 10:27:28 +0000
@@ -0,0 +1,58 @@
+
+a.cta-a {
+    float: left;
+    padding: 5px 10px;
+    border: 1px solid #ccc;
+    border-radius: 5px;
+    -moz-border-radius: 5px;
+    -webkit-border-radius: 5px;
+    background: #eeeded url(/web_process/static/src/img/cta-a.gif) repeat-x;
+    box-shadow: 0 1px 0 #fff;
+    -moz-box-shadow: 0 1px 0 #fff;
+    -webkit-box-shadow: 0 1px 0 #fff;
+    color: #8c8c8c;
+    font-size: 0.9em;
+    text-transform: uppercase;
+    font-weight: bold;
+    text-shadow: #fff 0 1px 0;
+    margin: 2px;
+}
+
+a.cta-a span {
+    float: left;
+    padding: 7px 0 5px 5px;
+    background-position: 0 50%;
+    background-repeat: no-repeat;
+    cursor: pointer;
+}
+
+a.cta-a strong {
+    display: block;
+    color: #393939;
+}
+
+.process_h1 {
+    background:url("/web_process/static/src/img/sep-a.gif") repeat-x scroll 0 90% transparent;
+    font-size:2em;
+    font-weight:normal;
+    padding:0 0 5px 5px;
+    line-height: 1.2;
+}
+
+.process-links {
+    padding: 5px 10px;
+    text-align: center;
+    display: table;
+    margin: auto;
+}
+
+.process-links a.cta-a {
+    display: table-cell;
+}
+
+.process-help-text {
+    float: left;
+    padding:5px 10px;
+    min-height:56px;
+    font-size: 120%;
+}
\ No newline at end of file

=== added directory 'addons/web_process/static/src/img'
=== added file 'addons/web_process/static/src/img/ToolOval.jpg'
Binary files addons/web_process/static/src/img/ToolOval.jpg	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/ToolOval.jpg	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/ToolShowGrid.jpg'
Binary files addons/web_process/static/src/img/ToolShowGrid.jpg	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/ToolShowGrid.jpg	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/ToolShowGrid.png'
Binary files addons/web_process/static/src/img/ToolShowGrid.png	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/ToolShowGrid.png	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/button-a-a.png'
Binary files addons/web_process/static/src/img/button-a-a.png	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/button-a-a.png	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/cta-a.gif'
Binary files addons/web_process/static/src/img/cta-a.gif	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/cta-a.gif	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/grid_10.jpg'
Binary files addons/web_process/static/src/img/grid_10.jpg	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/grid_10.jpg	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/iconset-a-help.gif'
Binary files addons/web_process/static/src/img/iconset-a-help.gif	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/iconset-a-help.gif	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/node-current.png'
Binary files addons/web_process/static/src/img/node-current.png	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/node-current.png	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/node-gray.png'
Binary files addons/web_process/static/src/img/node-gray.png	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/node-gray.png	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/node-subflow-gray.png'
Binary files addons/web_process/static/src/img/node-subflow-gray.png	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/node-subflow-gray.png	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/node-subflow.png'
Binary files addons/web_process/static/src/img/node-subflow.png	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/node-subflow.png	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/node.png'
Binary files addons/web_process/static/src/img/node.png	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/node.png	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/port.gif'
Binary files addons/web_process/static/src/img/port.gif	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/port.gif	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/sep-a.gif'
Binary files addons/web_process/static/src/img/sep-a.gif	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/sep-a.gif	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/window_bg.png'
Binary files addons/web_process/static/src/img/window_bg.png	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/window_bg.png	2011-09-21 10:27:28 +0000 differ
=== added file 'addons/web_process/static/src/img/window_toolbar.png'
Binary files addons/web_process/static/src/img/window_toolbar.png	1970-01-01 00:00:00 +0000 and addons/web_process/static/src/img/window_toolbar.png	2011-09-21 10:27:28 +0000 differ
=== added directory 'addons/web_process/static/src/js'
=== added file 'addons/web_process/static/src/js/process.js'
--- addons/web_process/static/src/js/process.js	1970-01-01 00:00:00 +0000
+++ addons/web_process/static/src/js/process.js	2011-09-21 10:27:28 +0000
@@ -0,0 +1,196 @@
+
+openerp.web_process = function (openerp) {
+var QWeb = openerp.web.qweb;
+QWeb.add_template('/web_process/static/src/xml/web_process.xml');
+	openerp.web.ViewManager.include({
+		start: function() {
+			this._super();
+	        var self = this;
+	        
+	        this.process_check();
+		},
+		process_check: function() {
+			var self = this,
+			grandparent = this.widget_parent && this.widget_parent.widget_parent,
+	        view = this.views[this.views_src[0].view_type],
+	        $process_view = this.$element.find('.oe-process-view');
+	        
+	        this.process_model = this.model;
+	        if (!(grandparent instanceof openerp.web.WebClient) ||
+                !(view.view_type === this.views_src[0].view_type
+                    && view.view_id === this.views_src[0].view_id)) {
+	        	$process_view.hide();
+                return;
+            }
+	        $process_view.click(function() {
+        		$.when(self.load_process()).then(self.get_process_id());
+	        });
+		},
+		
+		load_process: function() {
+			this.$element.html(QWeb.render("ProcessView",this));
+		},
+		
+		get_process_id: function() {
+			var self = this;
+			this.process_dataset = new openerp.web.DataSetStatic(this, "process.process", this.session.context);
+			this.process_dataset
+				.call(
+						"search_by_model",
+						[self.process_model,self.session.context],
+						function(res) {self.process_renderer(res)}
+					);
+		},
+		
+		process_renderer: function(res) {
+			var self = this;
+			if(!res.length) {
+				this.process_model = false;
+				this.get_process_id();
+			} else {
+				if(res.length > 1) {
+					this.selection = res;
+					$.when(this.load_process())
+						.then(function(){
+							var $parent = self.widget_parent.$element; 
+							$parent.find('#change_process').click(function() {
+								self.selection = false;
+								self.p_id = $parent.find('#select_process').val();
+								$.when(self.load_process()).then(self.render_process_view());
+							});
+						});
+				} else {
+					this.p_id = res[0][0];
+					$.when(this.load_process()).then(this.render_process_view());
+				}
+			}
+		},
+		render_process_view: function() {
+			var self = this;
+			this.p_id = parseInt(this.p_id, 10);
+			this.process_dataset
+				.call(
+					"graph_get",
+					[self.p_id, self.model, false, [80,80,150,100]],
+					function(res) {
+						res['title'] = res.resource ? res.resource : res.name;
+						self.process_dataset.call("search_by_model",[self.model,self.session.context],function(r){
+							res['related'] = r;
+						});
+						self.draw_process_graph(res);
+					}
+				);
+		},
+		
+		draw_process_graph: function(res) {
+			var self = this;
+			var process_graph = new Graph();
+			
+			var process_renderer = function(r, n) {
+				var process_node,
+					process_node_text,
+					process_node_desc,
+					process_set;
+				
+	            var node_button,
+	            	node_menu,
+	            	img_src;
+	            	
+	            var bg = "node";
+	            var clip_rect = "".concat(n.node.x,",",n.node.y,",150,100");
+	            var text_position_x  = n.node.kind == "subflow" ? n.node.x+88 : n.node.x+75;
+	            
+	            //Image part
+	            bg = n.node.kind == "subflow" ? "node-subflow" : "node";
+	            bg = n.node.gray ? bg + "-gray" : bg;
+	            img_src = '/web_process/static/src/img/'+ bg + '.png';
+	            
+	            r['image'](img_src, n.node.x, n.node.y,150, 100)
+	            		.attr({"clip-rect": clip_rect})
+	            		.mousedown(function(){
+	            			return false;
+	            		});
+	            
+	            //Node
+	            process_node = r['rect'](n.node.x, n.node.y, 150, 100).attr({stroke: "none"});
+	            
+	            // Node text
+	            process_node_text =  r.text(text_position_x, n.node.y+10, (n.node.name))
+	            					.attr({"fill": "#fff", "font-weight": "bold", "cursor": "pointer"});
+	            
+	            if(n.node.subflow) {
+	            	process_node_text.click(function() {
+	            		self.p_id = n.node.subflow[0];
+	            		$.when(self.load_process()).then(self.render_process_view());
+	            	});
+	            }
+	            
+	            //Node Description
+	            process_node_desc = r.text(n.node.x+75, n.node.y+50, (n.node.notes));
+	            
+	            r['image']('/web/static/src/img/icons/gtk-info.png', n.node.x+20, n.node.y+70, 16, 16)
+	            	.attr({"cursor": "pointer", "title": "Help"})
+	            	.click(function(){
+	            		window.open(n.node.url || "http://doc.openerp.com/v6.0/index.php?model="; + n.node.model);
+	            	});
+	            
+	            if(n.node.menu) {
+	            	r['image']('/web/static/src/img/icons/gtk-jump-to.png', n.node.x+115, n.node.y+70, 16, 16)
+	            	.attr({"cursor": "pointer", "title": n.node.menu.name})
+	            	.click(function() {
+	            		self.jump_to_view(n.node.res_model, n.node.menu.id);
+	            	});
+	            }
+	            
+	            process_set = r.set()
+	            	.push(process_node)
+	            process_set.mousedown(function() {
+	            	return false;
+	            });
+	            return process_set;
+			};
+			
+			_.each(res['nodes'],function(node, node_id) {
+				node['res_model'] = self.model,
+				node['res_id'] = false,
+				node['id'] = node_id;
+				process_graph.addNode(node['name'], {node: node,render: process_renderer});
+			});
+			
+			_.each(res['transitions'], function(transitions) {
+				
+				var src = res['nodes'][transitions['source']];
+				var dst = res['nodes'][transitions['target']];
+				// make active
+				transitions['active'] = src.active && !dst.gray;
+				process_graph.addEdge(src['name'], dst['name'], {directed : true, label: transitions['name']})
+			});
+			var layouter = new Graph.Layout.Ordered(process_graph);
+	        var render_process_graph = new Graph.Renderer.Raphael('process_canvas', process_graph, $('#process_canvas').width(), $('#process_canvas').height());
+		},
+		
+		jump_to_view: function(model, id) {
+			var self = this;
+			var dataset = new openerp.web.DataSetStatic(this, 'ir.values', this.session.context);
+			dataset
+				.call('get',
+						['action', 'tree_but_open',[['ir.ui.menu', id]], dataset.context],
+						function(res) {
+							self.$element.empty();
+							var action = res[0][res[0].length - 1];
+							self.rpc("/web/action/load", {
+		                        action_id: action.id,
+		                        context: dataset.context
+		                    }, function(result) {
+		                        var action_manager = new openerp.web.ActionManager(self);
+		                        action_manager.appendTo(self.widget_parent.$element);
+		                        action_manager.do_action(result.result);
+		                    });
+						}
+				);
+		}
+	});
+};
+
+
+// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:

=== added directory 'addons/web_process/static/src/xml'
=== added file 'addons/web_process/static/src/xml/web_process.xml'
--- addons/web_process/static/src/xml/web_process.xml	1970-01-01 00:00:00 +0000
+++ addons/web_process/static/src/xml/web_process.xml	2011-09-21 10:27:28 +0000
@@ -0,0 +1,67 @@
+<template>
+	<t t-extend="ViewManager" t-name="ViewManagerAction">
+		<t t-jquery=".oe_view_title" t-operation="append">
+			<img class="oe-process-view" src="/web/static/src/img/icons/gtk-help.png" title="ProcessView"/>
+		</t>
+	</t>
+	<t t-name="ProcessView">
+	    <table class="view" border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
+	        <tr>
+	            <td width="75%" valign="top" class="fields collapsed" style="padding-top:10px;">
+	                <h1 class="process_h1">
+	                	<t t-esc="action.name"/> (<t t-esc="model"/>)
+	                </h1>
+	                <p class="process-links">
+	                    <a class="cta-a" target="_blank" href="#">
+	                        <span>
+	                            <strong>Documentation</strong>
+	                            Read Documentation Online
+	                        </span>
+	
+	                    </a>
+	                    <a class="cta-a" target="_blank" href="http://www.openerp.com/forum/";>
+	                        <span>
+	                            <strong>Forum</strong>
+	                            Community Discussion
+	                        </span>
+	                    </a>
+	                    <a class="cta-a" target="_blank" href="http://www.openerp.com/services/books";>
+	                        <span>
+	                            <strong>Books</strong>
+	                            Get the book on Amazon
+	                        </span>
+	                    </a>
+	                    <a class="cta-a" target="_blank" href="http://www.openerp.com/services/subscribe-onsite";>
+	                        <span>
+	                            <strong>Support / Publisher Warranty</strong>
+	                            Get the OpenERP Warranty
+	                        </span>
+	                    </a>
+	                </p>
+	            </td>
+	        </tr>
+			<tr t-if="selection">
+	        	<td>
+	        		<fieldset>
+	        			<legend>
+	        				Select Process
+	        			</legend>
+		        		<select id="select_process">
+		        			<t t-foreach="selection" t-as="prc">
+		        				<option t-att-value="prc[0]">
+		        					<t t-esc="prc[1]"/>
+		        				</option>
+		        			</t>
+		    			</select>
+						<button id="change_process">Select</button>
+					</fieldset>
+	    		</td>
+	    	</tr>
+			<tr t-if="p_id">
+				<td>
+					<div id="process_canvas" style="overflow: auto;"></div>
+				</td>
+			</tr>
+	    </table>
+	</t>
+</template>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to