summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js/graph_view.js
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2014-01-22 14:34:52 +0100
committerGery Debongnie <ged@openerp.com>2014-01-22 14:34:52 +0100
commita3bb723379d5b9c9302658925c076ce4a341d76c (patch)
tree61485d43a88fd05ecb4bc715b6097a7284d765fd /addons/web_graph/static/src/js/graph_view.js
parentd0806ed3f7730e42aa4666c6122139121a9d7391 (diff)
[IMP] changes the backend code of graph view to use the new functionality of read_group (use 'field_name:interval' in readgroup instead of context (addon web_graph)
bzr revid: ged@openerp.com-20140122133452-wy3hrsrokhnwc3ru
Diffstat (limited to 'addons/web_graph/static/src/js/graph_view.js')
-rw-r--r--addons/web_graph/static/src/js/graph_view.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js
index 0c0e80c566f..a452efb78e6 100644
--- a/addons/web_graph/static/src/js/graph_view.js
+++ b/addons/web_graph/static/src/js/graph_view.js
@@ -80,8 +80,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.graph_widget = new openerp.web_graph.Graph(this, this.model, domain, this.widget_config);
this.graph_widget.appendTo(this.$el);
this.ViewManager.on('switch_mode', this, function (e) {
- var domain = self.graph_widget.get_domain(),
- col_gb = self.get_groupbys_from_searchview('ColGroupBy', 'col_group_by'),
+ var col_gb = self.get_groupbys_from_searchview('ColGroupBy', 'col_group_by'),
row_gb = self.get_groupbys_from_searchview('GroupBy', 'group_by');
if (e === 'graph') this.graph_widget.set(domain, row_gb, col_gb);
@@ -95,7 +94,13 @@ instance.web_graph.GraphView = instance.web.View.extend({
get_groupbys_from_searchview: function (cat_name, cat_field) {
var facet = this.search_view.query.findWhere({category:cat_name}),
groupby_list = facet ? facet.values.models : [];
- return _.map(groupby_list, function (g) { return g.attributes.value.attrs.context[cat_field]; });
+ return _.map(groupby_list, function (g) {
+ if (cat_name === 'GroupBy') {
+ return py.eval(g.attributes.value.attrs.context).group_by;
+ } else {
+ return g.attributes.value.attrs.context[cat_field];
+ }
+ });
},
do_show: function () {
@@ -158,7 +163,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
make_groupby_values: function (groupbys, category) {
return _.map(groupbys, function (groupby) {
var context = {};
- context[category] = groupby.field;
+ context[category] = groupby.interval ? groupby.field + ':' + groupby.interval : groupby.field;
var value = (category === 'group_by') ? groupby.filter : {attrs:{domain: [], context: context}};
return {
label: groupby.string,