[IMP] add access to model fields description in addon web_graph

bzr revid: ged@openerp.com-20131112083827-fy9i054l9mq3vynz
This commit is contained in:
Gery Debongnie 2013-11-12 09:38:27 +01:00
parent 4dd5ac9924
commit 6ecbf2ef80
1 changed files with 13 additions and 4 deletions

View File

@ -1,11 +1,10 @@
/*---------------------------------------------------------
* OpenERP web_graph
*---------------------------------------------------------*/
/*global openerp:true $:true*/
/*global $:true*/
/*global _:true*/
'use strict';
/* jshint undef: false */
openerp.web_graph = function (instance) {
@ -48,6 +47,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.measure = null;
this.domain = [];
this.model = null;
this.model_fields = [];
},
@ -71,6 +71,10 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.chart_view.appendTo('.graph_chart');
this.chart_view.hide();
this.get_data().done(this.pivot_table.draw);
return this.model.call('fields_get', []).then(function (fields) {
self.model_fields = fields;
});
},
get_data: function () {
@ -79,6 +83,10 @@ instance.web_graph.GraphView = instance.web.View.extend({
return query_groups(this.model, view_fields, this.domain, this.x_groups);
},
get_desc: function(field_id) {
return this.model_fields[field_id].string;
},
do_search: function (domain, context, group_by) {
this.domain = new instance.web.CompoundDomain(domain);
},
@ -106,7 +114,7 @@ var PivotTable = instance.web.Widget.extend({
},
draw: function (data) {
console.log("data",data);
console.log('data',data);
},
});
@ -260,3 +268,4 @@ function query_groups (model, fields, domain, groupbys) {
};