[IMP] improves the way the chart view understands the xml descr of the view, so that nows fields after the operator = + are considered col groupbys (addon web_graph)

bzr revid: ged@openerp.com-20131210111646-9d8l78npv72pqfp8
This commit is contained in:
Gery Debongnie 2013-12-10 12:16:46 +01:00
parent fe5543a043
commit 1419b07939
1 changed files with 7 additions and 2 deletions

View File

@ -43,6 +43,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.search_view = parent.searchview;
this.groupby_mode = 'default'; // 'default' or 'manual'
this.default_row_groupby = [];
this.default_col_groupby = [];
this.search_field = {
get_context: this.proxy('get_context'),
get_domain: function () {},
@ -83,7 +84,11 @@ instance.web_graph.GraphView = instance.web.View.extend({
if ('operator' in field.attrs) {
self.measure_list.push(field.attrs.name);
} else {
self.default_row_groupby.push(field.attrs.name);
if (self.measure_list.length) {
self.default_col_groupby.push(field.attrs.name);
} else {
self.default_row_groupby.push(field.attrs.name);
}
}
}
});
@ -139,7 +144,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.pivot_table.set_col_groupby(col_groupby);
} else {
this.pivot_table.set_row_groupby(_.toArray(this.default_row_groupby));
this.pivot_table.set_col_groupby([]);
this.pivot_table.set_col_groupby(_.toArray(this.default_col_groupby));
}
this.display_data();
},