[ADD] Summary Information. Fixed fields information look.

bzr revid: vda@tinyerp.com-20110930080000-7vuomze8cbun17oh
This commit is contained in:
Vaibhav (OpenERP) 2011-09-30 13:30:00 +05:30
parent 69238240cd
commit 02adb92519
2 changed files with 65 additions and 17 deletions

View File

@ -30,7 +30,6 @@ openerp.web_process = function (openerp) {
initialize_process_view: function() {
var self = this;
var is_ready = $.Deferred();
$.when(this.fields_get(), this.help(), this.get_process_object()).pipe(function(fields, help, process) {
self.process_fields = fields;
self.process_help = help;
@ -38,20 +37,29 @@ openerp.web_process = function (openerp) {
if(process.length > 1) {
self.process_selection = process;
} else {
self.process_id = process[0][0];
self.process_id = process[0][0],
self.process_title = process[0][1];
}
}
return $.Deferred().resolve();
}).done(function() {
self.render_process_view();
}).done(function() {
}).pipe(function() {
var def = $.Deferred();
if(self.process_id) {
self.graph_get().done(function(res) {
self.draw_process_graph(res);
self.process_notes = res.notes;
self.process_subflows = _.filter(res.nodes, function(x) {
return x.subflow != false;
});
self.process_related = res.related;
def.resolve(res);
});
}
} else def.resolve();
return def.promise();
}).done(function(res) {
$.when(self.render_process_view()).done(function() {
if(res) self.draw_process_graph(res);
});
});
},
graph_get: function() {
@ -140,17 +148,21 @@ openerp.web_process = function (openerp) {
var $parent = this.widget_parent.$element;
$parent.find('#change_process').click(function() {
self.process_selection = false;
self.process_id = $parent.find('#select_process').val();
self.process_selection = false,
self.process_id = $parent.find('#select_process').val(),
self.process_title = $.trim($parent.find('#select_process option:selected').text());
self.initialize_process_view();
});
this.$element.find(".toggle_fields").click(function() {
$(this).children().toggle();
self.$element.find('.process_fields').toggle();
})
});
this.$element.find(".process_subflow").click(function() {
self.process_id = this.id;
self.initialize_process_view();
});
},
draw_process_graph : function(res) {

View File

@ -44,6 +44,42 @@
<p><t t-esc="process_help"/></p>
</td>
</tr>
<tr>
<td>
<h2>
<t t-esc="process_title"/> Process
</h2>
<t t-if="process_notes">
<p>
<strong>Notes:</strong> <t t-esc="process_notes"/>
</p>
<p>
<strong>Last modified by:</strong> N/A
</p>
<t t-if="process_subflows">
<strong>Subflows:</strong>
<t t-foreach="process_subflows" t-as="subflow">
<t t-if="subflow.subflow[0] != process_id">
<p>
<a class="process_subflow" t-att-id="subflow.subflow[0]" href="javascript: void(0)">
<t t-esc="subflow.subflow[1]"/>
</a>
</p>
</t>
</t>
</t>
<t t-if="process_related and process_related[0][0] != process_id">
<strong>Related:</strong>
<p>
<a class="process_subflow" t-att-id="process_related[0][0]" href="javascript: void(0)">
<t t-esc="process_related[0][1]"/>
</a>
</p>
</t>
</t>
</td>
</tr>
<tr t-if="process_selection">
<td>
<fieldset>
@ -77,21 +113,21 @@
</tr>
<tr t-if="process_id">
<td class="process_fields">
<table cellspacing="0" cellpadding="0" width="100%">
<table>
<t t-foreach="process_fields" t-as="field">
<tr>
<td>
<t t-esc="field"/>
</td>
<td>
<table cellspacing="0" cellpadding="0" width="100%">
<t t-foreach="process_fields[field]" t-as="fld">
<table>
<t t-foreach="field_value" t-as="fld">
<tr>
<td>
<t t-esc="fld"/>:
</td>
<td>
<t t-esc="process_fields[field][fld]"/>
<t t-esc="fld_value"/>
</td>
</tr>
</t>