From 11de0f36ed923f0222d8e1ecc603b53366eabf75 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Tue, 14 Jan 2014 13:51:42 +0100 Subject: [REF] separates graph view and graph widget into two files, and renames pivot into pivot_table.js (addon web_graph) bzr revid: ged@openerp.com-20140114125142-9qj3mvu0a1fp4sis --- addons/web_graph/static/src/js/graph_view.js | 177 +++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 addons/web_graph/static/src/js/graph_view.js (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js new file mode 100644 index 00000000000..1b940c1703a --- /dev/null +++ b/addons/web_graph/static/src/js/graph_view.js @@ -0,0 +1,177 @@ +/*--------------------------------------------------------- + * OpenERP web_graph + *---------------------------------------------------------*/ + +/* jshint undef: false */ + +openerp.web_graph = function (instance) { +'use strict'; + +var _lt = instance.web._lt; +var _t = instance.web._t; + +instance.web.views.add('graph', 'instance.web_graph.GraphView'); + +instance.web_graph.GraphView = instance.web.View.extend({ + display_name: _lt('Graph'), + view_type: 'graph', + + init: function(parent, dataset, view_id, options) { + this._super(parent, dataset, view_id, options); + this.dataset = dataset; + this.model = new instance.web.Model(dataset.model, {group_by_no_leaf: true}); + this.search_view = parent.searchview; + this.search_view_groupby = []; + 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 () {}, + get_groupby: function () { }, + }; + }, + + view_loading: function (fields_view_get) { + var self = this, + arch = fields_view_get.arch; + + this.widget_config = { + title: arch.attrs.string, + stacked : (arch.attrs.stacked === 'True'), + mode: (arch.attrs.type) ? arch.attrs.type : 'bar', + measures: [], + }; + + _.each(arch.children, function (field) { + if (_.has(field.attrs, 'type')) { + switch (field.attrs.type) { + case 'row': + self.default_row_groupby.push(field.attrs.name); + break; + case 'col': + self.default_col_groupby.push(field.attrs.name); + break; + case 'measure': + self.widget_config.measures.push(field.attrs.name); + break; + } + } else { // old style, kept for backward compatibility + if ('operator' in field.attrs) { + self.widget_config.measures.push(field.attrs.name); + } else { + self.default_row_groupby.push(field.attrs.name); + } + } + }); + if (self.widget_config.measures.length === 0) { + self.widget_config.measures.push('__count'); + } + this.widget_config.row_groupby = self.default_row_groupby; + this.widget_config.col_groupby = self.default_col_groupby; + }, + + get_context: function (facet) { + var col_group_by = _.map(facet.values.models, function (model) { + return model.attributes.value.attrs.context.col_group_by; + }); + return {col_group_by : col_group_by}; + }, + + do_search: function (domain, context, group_by) { + // var col_groupby = context.col_group_by || [], + // options = {domain:domain}; + + if (!this.graph_widget) { + this.graph_widget = new openerp.web_graph.Graph(this, this.model, domain, this.widget_config); + this.graph_widget.appendTo(this.$el); + this.graph_widget.on('groupby_changed', this, this.proxy('register_groupby')); + this.ViewManager.on('switch_mode', this, function (e) { if (e === 'graph') this.graph_widget.reload(); }); + } + // this.search_view_groupby = group_by; + + // if (group_by.length && this.groupby_mode !== 'manual') { + // if (_.isEqual(col_groupby, [])) { + // col_groupby = this.default_col_groupby; + // } + // } + // if (group_by.length || col_groupby.length) { + // this.groupby_mode = 'manual'; + // } + // if (!this.graph_widget.enabled) { + // options.update = false; + // options.silent = true; + // } + + // if (this.groupby_mode === 'manual') { + // options.row_groupby = group_by; + // options.col_groupby = col_groupby; + // } else { + // options.row_groupby = _.toArray(this.default_row_groupby); + // options.col_groupby = _.toArray(this.default_col_groupby); + // } + // this.graph_widget.set(domain, options.row_groupby, options.col_groupby); + // this.graph_widget.set_domain(domain); + // this.graph_widget.set_col_groupby(options.col_groupby); + // this.graph_widget.set_row_groupby(options.row_groupby); + + }, + + do_show: function () { + this.do_push_state({}); + return this._super(); + }, + + register_groupby: function() { + // var self = this, + // query = this.search_view.query; + + // this.groupby_mode = 'manual'; + // if (_.isEqual(this.search_view_groupby, this.graph_widget.pivot.rows.groupby) || + // (!_.has(this.search_view, '_s_groupby'))) { + // return; + // } + // var rows = _.map(this.graph_widget.pivot.rows.groupby, function (group) { + // return make_facet('GroupBy', group); + // }); + // var cols = _.map(this.graph_widget.pivot.cols.groupby, function (group) { + // return make_facet('ColGroupBy', group); + // }); + + // query.reset(rows.concat(cols)); + + // function make_facet (category, fields) { + // var values, + // icon, + // backbone_field, + // cat_name; + // if (!(fields instanceof Array)) { fields = [fields]; } + // if (category === 'GroupBy') { + // cat_name = 'group_by'; + // icon = 'w'; + // backbone_field = self.search_view._s_groupby; + // } else { + // cat_name = 'col_group_by'; + // icon = 'f'; + // backbone_field = self.search_field; + // } + // values = _.map(fields, function (field) { + // var context = {}; + // context[cat_name] = field; + // return {label: self.graph_widget.fields[field].string, value: {attrs:{domain: [], context: context}}}; + // }); + // return {category:category, values: values, icon:icon, field: backbone_field}; + // } + }, +}); + + +}; + + + + + + + + -- cgit v1.2.3 From cf81efda4309f895f6777c46c39f1fe894f109cf Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Wed, 15 Jan 2014 10:37:49 +0100 Subject: [IMP] adds search view integration in graph view (addon web_graph) bzr revid: ged@openerp.com-20140115093749-t2s0306fchm2tnir --- addons/web_graph/static/src/js/graph_view.js | 140 ++++++++++----------------- 1 file changed, 51 insertions(+), 89 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index 1b940c1703a..eb901c28423 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -16,20 +16,14 @@ instance.web_graph.GraphView = instance.web.View.extend({ display_name: _lt('Graph'), view_type: 'graph', + // ---------------------------------------------------------------------- + // Init stuff + // ---------------------------------------------------------------------- init: function(parent, dataset, view_id, options) { this._super(parent, dataset, view_id, options); this.dataset = dataset; this.model = new instance.web.Model(dataset.model, {group_by_no_leaf: true}); this.search_view = parent.searchview; - this.search_view_groupby = []; - 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 () {}, - get_groupby: function () { }, - }; }, view_loading: function (fields_view_get) { @@ -41,16 +35,18 @@ instance.web_graph.GraphView = instance.web.View.extend({ stacked : (arch.attrs.stacked === 'True'), mode: (arch.attrs.type) ? arch.attrs.type : 'bar', measures: [], + row_groupby: [], + col_groupby: [], }; _.each(arch.children, function (field) { if (_.has(field.attrs, 'type')) { switch (field.attrs.type) { case 'row': - self.default_row_groupby.push(field.attrs.name); + self.widget_config.row_groupby.push(field.attrs.name); break; case 'col': - self.default_col_groupby.push(field.attrs.name); + self.widget_config.col_groupby.push(field.attrs.name); break; case 'measure': self.widget_config.measures.push(field.attrs.name); @@ -60,61 +56,28 @@ instance.web_graph.GraphView = instance.web.View.extend({ if ('operator' in field.attrs) { self.widget_config.measures.push(field.attrs.name); } else { - self.default_row_groupby.push(field.attrs.name); + self.widet_config.row_groupby.push(field.attrs.name); } } }); if (self.widget_config.measures.length === 0) { self.widget_config.measures.push('__count'); } - this.widget_config.row_groupby = self.default_row_groupby; - this.widget_config.col_groupby = self.default_col_groupby; - }, - - get_context: function (facet) { - var col_group_by = _.map(facet.values.models, function (model) { - return model.attributes.value.attrs.context.col_group_by; - }); - return {col_group_by : col_group_by}; }, do_search: function (domain, context, group_by) { - // var col_groupby = context.col_group_by || [], - // options = {domain:domain}; - if (!this.graph_widget) { + if (group_by.length) { + this.widget_config.row_groupby = group_by; + } this.graph_widget = new openerp.web_graph.Graph(this, this.model, domain, this.widget_config); this.graph_widget.appendTo(this.$el); this.graph_widget.on('groupby_changed', this, this.proxy('register_groupby')); this.ViewManager.on('switch_mode', this, function (e) { if (e === 'graph') this.graph_widget.reload(); }); + return; } - // this.search_view_groupby = group_by; - - // if (group_by.length && this.groupby_mode !== 'manual') { - // if (_.isEqual(col_groupby, [])) { - // col_groupby = this.default_col_groupby; - // } - // } - // if (group_by.length || col_groupby.length) { - // this.groupby_mode = 'manual'; - // } - // if (!this.graph_widget.enabled) { - // options.update = false; - // options.silent = true; - // } - - // if (this.groupby_mode === 'manual') { - // options.row_groupby = group_by; - // options.col_groupby = col_groupby; - // } else { - // options.row_groupby = _.toArray(this.default_row_groupby); - // options.col_groupby = _.toArray(this.default_col_groupby); - // } - // this.graph_widget.set(domain, options.row_groupby, options.col_groupby); - // this.graph_widget.set_domain(domain); - // this.graph_widget.set_col_groupby(options.col_groupby); - // this.graph_widget.set_row_groupby(options.row_groupby); + this.graph_widget.set(domain, group_by, this.graph_widget.get_col_groupby()); }, do_show: function () { @@ -122,47 +85,46 @@ instance.web_graph.GraphView = instance.web.View.extend({ return this._super(); }, + // ---------------------------------------------------------------------- + // Search view integration + // ---------------------------------------------------------------------- + + // add groupby to the search view register_groupby: function() { - // var self = this, - // query = this.search_view.query; - - // this.groupby_mode = 'manual'; - // if (_.isEqual(this.search_view_groupby, this.graph_widget.pivot.rows.groupby) || - // (!_.has(this.search_view, '_s_groupby'))) { - // return; - // } - // var rows = _.map(this.graph_widget.pivot.rows.groupby, function (group) { - // return make_facet('GroupBy', group); - // }); - // var cols = _.map(this.graph_widget.pivot.cols.groupby, function (group) { - // return make_facet('ColGroupBy', group); - // }); - - // query.reset(rows.concat(cols)); - - // function make_facet (category, fields) { - // var values, - // icon, - // backbone_field, - // cat_name; - // if (!(fields instanceof Array)) { fields = [fields]; } - // if (category === 'GroupBy') { - // cat_name = 'group_by'; - // icon = 'w'; - // backbone_field = self.search_view._s_groupby; - // } else { - // cat_name = 'col_group_by'; - // icon = 'f'; - // backbone_field = self.search_field; - // } - // values = _.map(fields, function (field) { - // var context = {}; - // context[cat_name] = field; - // return {label: self.graph_widget.fields[field].string, value: {attrs:{domain: [], context: context}}}; - // }); - // return {category:category, values: values, icon:icon, field: backbone_field}; - // } + var query = this.search_view.query; + + if (!_.has(this.search_view, '_s_groupby')) { return; } + + var row_groupby = this.graph_widget.get_row_groupby(); + var gb_facet = this.make_groupby_facets(row_groupby); + var search_facet = query.findWhere({category:'GroupBy'}); + + if (search_facet) { + search_facet.values.reset(gb_facet.values); + } else { + if (row_groupby.length) { + query.add(gb_facet); + } + } }, + + make_groupby_facets: function(fields) { + var self = this, + values = _.map(fields, function (field) { + return { + label: self.graph_widget.fields[field].string, + value: {attrs:{domain: [], context: {group_by: field}}} + }; + }); + return {category:'GroupBy', values: values, icon:'w', field: self.search_view._s_groupby}; + }, + + search_field: { + get_context: function() {}, + get_domain: function () {}, + get_groupby: function () { }, + }, + }); -- cgit v1.2.3 From 74d6e75007ea089d79190e58a2579aaa8cd46060 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Wed, 15 Jan 2014 16:51:37 +0100 Subject: [IMP] supports col groupby in search view in graph view (addon web_graph) bzr revid: ged@openerp.com-20140115155137-qwy0sr49zhizgmf6 --- addons/web_graph/static/src/js/graph_view.js | 77 +++++++++++++++++++++------- 1 file changed, 59 insertions(+), 18 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index eb901c28423..c2b3979199f 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -66,10 +66,15 @@ instance.web_graph.GraphView = instance.web.View.extend({ }, do_search: function (domain, context, group_by) { + var col_group_by = this.get_col_groupbys_from_searchview(); + if (!this.graph_widget) { if (group_by.length) { this.widget_config.row_groupby = group_by; } + if (col_group_by.length) { + this.widget_config.col_groupby = group_by; + } this.graph_widget = new openerp.web_graph.Graph(this, this.model, domain, this.widget_config); this.graph_widget.appendTo(this.$el); this.graph_widget.on('groupby_changed', this, this.proxy('register_groupby')); @@ -77,7 +82,13 @@ instance.web_graph.GraphView = instance.web.View.extend({ return; } - this.graph_widget.set(domain, group_by, this.graph_widget.get_col_groupby()); + this.graph_widget.set(domain, group_by, col_group_by); + }, + + get_col_groupbys_from_searchview: function () { + var facet = this.search_view.query.findWhere({category:'ColGroupBy'}), + groupby_list = facet ? facet.attributes.values : []; + return _.map(groupby_list, function (g) { return g.value.attrs.context.col_group_by; }); }, do_show: function () { @@ -95,39 +106,69 @@ instance.web_graph.GraphView = instance.web.View.extend({ if (!_.has(this.search_view, '_s_groupby')) { return; } - var row_groupby = this.graph_widget.get_row_groupby(); - var gb_facet = this.make_groupby_facets(row_groupby); - var search_facet = query.findWhere({category:'GroupBy'}); + // add row groupbys + var row_groupby = this.graph_widget.get_row_groupby(), + row_facet = this.make_row_groupby_facets(row_groupby), + row_search_facet = query.findWhere({category:'GroupBy'}); - if (search_facet) { - search_facet.values.reset(gb_facet.values); + if (row_search_facet) { + row_search_facet.values.reset(row_facet.values); } else { if (row_groupby.length) { - query.add(gb_facet); + query.add(row_facet); + } + } + // add col groupbys + var col_groupby = this.graph_widget.get_col_groupby(), + col_facet = this.make_col_groupby_facets(col_groupby), + col_search_facet = query.findWhere({category:'ColGroupBy'}); + + if (col_search_facet) { + col_search_facet.values.reset(col_facet.values); + } else { + if (col_groupby.length) { + query.add(col_facet); } } }, - make_groupby_facets: function(fields) { - var self = this, - values = _.map(fields, function (field) { - return { - label: self.graph_widget.fields[field].string, - value: {attrs:{domain: [], context: {group_by: field}}} - }; - }); - return {category:'GroupBy', values: values, icon:'w', field: self.search_view._s_groupby}; + make_row_groupby_facets: function(groupbys) { + return { + category:'GroupBy', + values: this.make_groupby_values(groupbys, 'group_by'), + icon:'w', + field: this.search_view._s_groupby + }; + }, + + make_col_groupby_facets: function(groupbys) { + return { + category:'ColGroupBy', + values: this.make_groupby_values(groupbys, 'col_group_by'), + icon:'f', + field: this.search_field + }; + }, + + make_groupby_values: function (groupbys, category) { + return _.map(groupbys, function (groupby) { + var context = {}; + context[category] = groupby.field; + return { + label: groupby.string, + value: {attrs:{domain: [], context: context}} + }; + }); }, search_field: { get_context: function() {}, get_domain: function () {}, - get_groupby: function () { }, + get_groupby: function () {}, }, }); - }; -- cgit v1.2.3 From 588e5413872c5c50ba9f48d4fd094ae1ba05e3c7 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Thu, 16 Jan 2014 10:55:49 +0100 Subject: [FIX] fixes some issues with the col_group_bys in searchbar (main problem was that do_search is called twice when the user swap axis) (addon web_graph) bzr revid: ged@openerp.com-20140116095549-3f2hbyzj32nuj147 --- addons/web_graph/static/src/js/graph_view.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index c2b3979199f..91fcefaf1b8 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -78,17 +78,23 @@ 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.graph_widget.on('groupby_changed', this, this.proxy('register_groupby')); + this.graph_widget.on('groupby_swapped', this, this.proxy('swap_groupby')); this.ViewManager.on('switch_mode', this, function (e) { if (e === 'graph') this.graph_widget.reload(); }); return; } + if (this.swapped) { + this.swapped = false; + return; + } + this.graph_widget.set(domain, group_by, col_group_by); }, get_col_groupbys_from_searchview: function () { var facet = this.search_view.query.findWhere({category:'ColGroupBy'}), - groupby_list = facet ? facet.attributes.values : []; - return _.map(groupby_list, function (g) { return g.value.attrs.context.col_group_by; }); + groupby_list = facet ? facet.values.models : []; + return _.map(groupby_list, function (g) { return g.attributes.value.attrs.context.col_group_by; }); }, do_show: function () { @@ -132,6 +138,11 @@ instance.web_graph.GraphView = instance.web.View.extend({ } }, + swap_groupby: function () { + this.swap = true; + this.register_groupby(); + }, + make_row_groupby_facets: function(groupbys) { return { category:'GroupBy', -- cgit v1.2.3 From feff16b03e29974567edbf6dd0f656adf280ec54 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Fri, 17 Jan 2014 09:58:42 +0100 Subject: [FIX] fixes a typo 'widet_config' => 'widget_config' (it previously crashed the graph view) (addon web_graph) bzr revid: ged@openerp.com-20140117085842-vxaxes0yv3dr7t24 --- addons/web_graph/static/src/js/graph_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index 91fcefaf1b8..a192952ab5c 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -56,7 +56,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ if ('operator' in field.attrs) { self.widget_config.measures.push(field.attrs.name); } else { - self.widet_config.row_groupby.push(field.attrs.name); + self.widget_config.row_groupby.push(field.attrs.name); } } }); -- cgit v1.2.3 From ba9999c28aa0e821924e5792a672eb429467ab6c Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Fri, 17 Jan 2014 17:19:40 +0100 Subject: [FIX] fix crash happening when user goes to graph view, switch to other view, changes groupby and goes back to graph view. (addon web_graph) bzr revid: ged@openerp.com-20140117161940-3ojz17luxtsb9qfa --- addons/web_graph/static/src/js/graph_view.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index a192952ab5c..0af32c8af7d 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -66,7 +66,8 @@ instance.web_graph.GraphView = instance.web.View.extend({ }, do_search: function (domain, context, group_by) { - var col_group_by = this.get_col_groupbys_from_searchview(); + var self = this, + col_group_by = this.get_col_groupbys_from_searchview(); if (!this.graph_widget) { if (group_by.length) { @@ -79,7 +80,13 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.graph_widget.appendTo(this.$el); this.graph_widget.on('groupby_changed', this, this.proxy('register_groupby')); this.graph_widget.on('groupby_swapped', this, this.proxy('swap_groupby')); - this.ViewManager.on('switch_mode', this, function (e) { if (e === 'graph') this.graph_widget.reload(); }); + this.ViewManager.on('switch_mode', this, function (e) { + var domain = self.graph_widget.get_domain(), + col_gb = self.get_col_groupbys_from_searchview(), + row_gb = self.get_row_groupbys_from_searchview(); + + if (e === 'graph') this.graph_widget.set(domain, row_gb, col_gb); + }); return; } @@ -97,6 +104,12 @@ instance.web_graph.GraphView = instance.web.View.extend({ return _.map(groupby_list, function (g) { return g.attributes.value.attrs.context.col_group_by; }); }, + get_row_groupbys_from_searchview: function () { + var facet = this.search_view.query.findWhere({category:'GroupBy'}), + groupby_list = facet ? facet.values.models : []; + return _.map(groupby_list, function (g) { return g.attributes.value.attrs.context.group_by; }); + }, + do_show: function () { this.do_push_state({}); return this._super(); -- cgit v1.2.3 From 2cafcfbde7612c1d16513ad7ddc416de7d6a6497 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Tue, 21 Jan 2014 15:30:34 +0100 Subject: [REF] large refactoring in graph view: changes the flow of the program to make it much simpler (addon web_graph) bzr revid: ged@openerp.com-20140121143034-rid4saax5y63g7i1 --- addons/web_graph/static/src/js/graph_view.js | 51 +++++++++------------------- 1 file changed, 16 insertions(+), 35 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index 0af32c8af7d..0c0e80c566f 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -30,13 +30,14 @@ instance.web_graph.GraphView = instance.web.View.extend({ var self = this, arch = fields_view_get.arch; - this.widget_config = { + this.widget_config = { title: arch.attrs.string, stacked : (arch.attrs.stacked === 'True'), mode: (arch.attrs.type) ? arch.attrs.type : 'bar', measures: [], row_groupby: [], col_groupby: [], + graph_view: this, }; _.each(arch.children, function (field) { @@ -67,7 +68,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ do_search: function (domain, context, group_by) { var self = this, - col_group_by = this.get_col_groupbys_from_searchview(); + col_group_by = this.get_groupbys_from_searchview('ColGroupBy', 'col_group_by'); if (!this.graph_widget) { if (group_by.length) { @@ -78,36 +79,23 @@ 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.graph_widget.on('groupby_changed', this, this.proxy('register_groupby')); - this.graph_widget.on('groupby_swapped', this, this.proxy('swap_groupby')); - this.ViewManager.on('switch_mode', this, function (e) { + this.ViewManager.on('switch_mode', this, function (e) { var domain = self.graph_widget.get_domain(), - col_gb = self.get_col_groupbys_from_searchview(), - row_gb = self.get_row_groupbys_from_searchview(); + 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); + if (e === 'graph') this.graph_widget.set(domain, row_gb, col_gb); }); return; } - if (this.swapped) { - this.swapped = false; - return; - } - this.graph_widget.set(domain, group_by, col_group_by); }, - get_col_groupbys_from_searchview: function () { - var facet = this.search_view.query.findWhere({category:'ColGroupBy'}), + 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.col_group_by; }); - }, - - get_row_groupbys_from_searchview: function () { - var facet = this.search_view.query.findWhere({category:'GroupBy'}), - groupby_list = facet ? facet.values.models : []; - return _.map(groupby_list, function (g) { return g.attributes.value.attrs.context.group_by; }); + return _.map(groupby_list, function (g) { return g.attributes.value.attrs.context[cat_field]; }); }, do_show: function () { @@ -120,14 +108,13 @@ instance.web_graph.GraphView = instance.web.View.extend({ // ---------------------------------------------------------------------- // add groupby to the search view - register_groupby: function() { + register_groupby: function(row_groupby, col_groupby) { var query = this.search_view.query; if (!_.has(this.search_view, '_s_groupby')) { return; } // add row groupbys - var row_groupby = this.graph_widget.get_row_groupby(), - row_facet = this.make_row_groupby_facets(row_groupby), + var row_facet = this.make_row_groupby_facets(row_groupby), row_search_facet = query.findWhere({category:'GroupBy'}); if (row_search_facet) { @@ -138,8 +125,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ } } // add col groupbys - var col_groupby = this.graph_widget.get_col_groupby(), - col_facet = this.make_col_groupby_facets(col_groupby), + var col_facet = this.make_col_groupby_facets(col_groupby), col_search_facet = query.findWhere({category:'ColGroupBy'}); if (col_search_facet) { @@ -151,11 +137,6 @@ instance.web_graph.GraphView = instance.web.View.extend({ } }, - swap_groupby: function () { - this.swap = true; - this.register_groupby(); - }, - make_row_groupby_facets: function(groupbys) { return { category:'GroupBy', @@ -178,9 +159,10 @@ instance.web_graph.GraphView = instance.web.View.extend({ return _.map(groupbys, function (groupby) { var context = {}; context[category] = groupby.field; + var value = (category === 'group_by') ? groupby.filter : {attrs:{domain: [], context: context}}; return { - label: groupby.string, - value: {attrs:{domain: [], context: context}} + label: groupby.string, + value: value }; }); }, @@ -192,7 +174,6 @@ instance.web_graph.GraphView = instance.web.View.extend({ }, }); - }; -- cgit v1.2.3 From a3bb723379d5b9c9302658925c076ce4a341d76c Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Wed, 22 Jan 2014 14:34:52 +0100 Subject: [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 --- addons/web_graph/static/src/js/graph_view.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') 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, -- cgit v1.2.3 From 39e0f4736f447fe5e4160e670a74e0b79a5ad266 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Wed, 22 Jan 2014 17:07:07 +0100 Subject: [REF] refactoring: removes the 'interval' attributes in groupbys and improves searchbar integration (addon web_graph) bzr revid: ged@openerp.com-20140122160707-39el7frwfj4pwd4d --- addons/web_graph/static/src/js/graph_view.js | 32 +++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index a452efb78e6..6d121bdc6c5 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -20,10 +20,16 @@ instance.web_graph.GraphView = instance.web.View.extend({ // Init stuff // ---------------------------------------------------------------------- init: function(parent, dataset, view_id, options) { + var self = this; this._super(parent, dataset, view_id, options); this.dataset = dataset; this.model = new instance.web.Model(dataset.model, {group_by_no_leaf: true}); this.search_view = parent.searchview; + this.col_search_field = { + get_context: function() { return { col_group_by: self.graph_widget.get_col_groupbys()};}, + get_domain: function () {}, + get_groupby: function () {}, + }; }, view_loading: function (fields_view_get) { @@ -68,7 +74,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ do_search: function (domain, context, group_by) { var self = this, - col_group_by = this.get_groupbys_from_searchview('ColGroupBy', 'col_group_by'); + col_group_by = context.col_group_by || this.get_groupbys_from_searchview('ColGroupBy', 'col_group_by'); if (!this.graph_widget) { if (group_by.length) { @@ -95,10 +101,11 @@ instance.web_graph.GraphView = instance.web.View.extend({ var facet = this.search_view.query.findWhere({category:cat_name}), groupby_list = facet ? facet.values.models : []; return _.map(groupby_list, function (g) { - if (cat_name === 'GroupBy') { - return py.eval(g.attributes.value.attrs.context).group_by; + var context = g.attributes.value.attrs.context; + if (_.isString(context)) { + return py.eval(context).group_by; } else { - return g.attributes.value.attrs.context[cat_field]; + return context[cat_field]; } }); }, @@ -156,15 +163,21 @@ instance.web_graph.GraphView = instance.web.View.extend({ category:'ColGroupBy', values: this.make_groupby_values(groupbys, 'col_group_by'), icon:'f', - field: this.search_field + field: this.col_search_field }; }, make_groupby_values: function (groupbys, category) { return _.map(groupbys, function (groupby) { var context = {}; - context[category] = groupby.interval ? groupby.field + ':' + groupby.interval : groupby.field; - var value = (category === 'group_by') ? groupby.filter : {attrs:{domain: [], context: context}}; + context[category] = groupby.field; + var value; + if (category === 'group_by' && groupby.type !== 'date' && groupby.type !== 'datetime') { + value = groupby.filter; + } else { + value = {attrs: {domain: [], context: context}}; + } + // var value = (category === 'group_by') ? groupby.filter : {attrs:{domain: [], context: context}}; return { label: groupby.string, value: value @@ -172,11 +185,6 @@ instance.web_graph.GraphView = instance.web.View.extend({ }); }, - search_field: { - get_context: function() {}, - get_domain: function () {}, - get_groupby: function () {}, - }, }); }; -- cgit v1.2.3 From b83cfc2c2b900f33d08ba068ab7b4d468ddb3017 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Thu, 23 Jan 2014 12:34:50 +0100 Subject: [FIX] fixes a crash happening when in dashboards, the graph view was trying to access undefined attributes (addon web_graph) bzr revid: ged@openerp.com-20140123113450-ec4fubf1urkdutw7 --- addons/web_graph/static/src/js/graph_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index 6d121bdc6c5..39634ff103a 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -173,7 +173,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ context[category] = groupby.field; var value; if (category === 'group_by' && groupby.type !== 'date' && groupby.type !== 'datetime') { - value = groupby.filter; + value = groupby.filter || {attrs: {domain: [], context: context}}; } else { value = {attrs: {domain: [], context: context}}; } -- cgit v1.2.3 From 29d08d9a6bc31b5ddaccaca78c97e9f093725069 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Fri, 24 Jan 2014 09:42:22 +0100 Subject: [IMP] graph_view now properly honors the 'interval' attribute of field names in the xml description (addon web_graph) bzr revid: ged@openerp.com-20140124084222-dq1gpg1tg8rinozx --- addons/web_graph/static/src/js/graph_view.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index 39634ff103a..1122089f060 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -47,23 +47,27 @@ instance.web_graph.GraphView = instance.web.View.extend({ }; _.each(arch.children, function (field) { + var field_name = field.attrs.name; + if (_.has(field.attrs, 'interval')) { + field_name = field.attrs.name + ':' + field.attrs.interval; + } if (_.has(field.attrs, 'type')) { switch (field.attrs.type) { case 'row': - self.widget_config.row_groupby.push(field.attrs.name); + self.widget_config.row_groupby.push(field_name); break; case 'col': - self.widget_config.col_groupby.push(field.attrs.name); + self.widget_config.col_groupby.push(field_name); break; case 'measure': - self.widget_config.measures.push(field.attrs.name); + self.widget_config.measures.push(field_name); break; } } else { // old style, kept for backward compatibility if ('operator' in field.attrs) { - self.widget_config.measures.push(field.attrs.name); + self.widget_config.measures.push(field_name); } else { - self.widget_config.row_groupby.push(field.attrs.name); + self.widget_config.row_groupby.push(field_name); } } }); -- cgit v1.2.3 From c43147628b6cfe9eb62b0da797cdff3f2c53d443 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Fri, 24 Jan 2014 16:16:35 +0100 Subject: [REF] lots of small tweaks to improve the code, and some small fixes, after xmo's code review (addon web_graph) bzr revid: ged@openerp.com-20140124151635-14l3dchnrmujo5ni --- addons/web_graph/static/src/js/graph_view.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index 1122089f060..e1a50d4ff6d 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -39,7 +39,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.widget_config = { title: arch.attrs.string, stacked : (arch.attrs.stacked === 'True'), - mode: (arch.attrs.type) ? arch.attrs.type : 'bar', + mode: arch.attrs.type || 'bar', measures: [], row_groupby: [], col_groupby: [], @@ -181,15 +181,12 @@ instance.web_graph.GraphView = instance.web.View.extend({ } else { value = {attrs: {domain: [], context: context}}; } - // var value = (category === 'group_by') ? groupby.filter : {attrs:{domain: [], context: context}}; return { label: groupby.string, value: value }; }); }, - - }); }; -- cgit v1.2.3 From 88b7511f6883ed42e113f818449fb2fa61c9c40b Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Fri, 7 Feb 2014 14:53:39 +0100 Subject: [FIX] correctly use the col group by instead of groupby when reading the context and initializing a graph view (addon web_graph) bzr revid: ged@openerp.com-20140207135339-ohrjh6uvu22tjavh --- addons/web_graph/static/src/js/graph_view.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index e1a50d4ff6d..b39ac105ee4 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -50,7 +50,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ var field_name = field.attrs.name; if (_.has(field.attrs, 'interval')) { field_name = field.attrs.name + ':' + field.attrs.interval; - } + } if (_.has(field.attrs, 'type')) { switch (field.attrs.type) { case 'row': @@ -78,14 +78,14 @@ instance.web_graph.GraphView = instance.web.View.extend({ do_search: function (domain, context, group_by) { var self = this, - col_group_by = context.col_group_by || this.get_groupbys_from_searchview('ColGroupBy', 'col_group_by'); + col_group_by = this.extract_groupby('col_group_by', context) || []; if (!this.graph_widget) { if (group_by.length) { this.widget_config.row_groupby = group_by; } if (col_group_by.length) { - this.widget_config.col_groupby = group_by; + this.widget_config.col_groupby = col_group_by; } this.graph_widget = new openerp.web_graph.Graph(this, this.model, domain, this.widget_config); this.graph_widget.appendTo(this.$el); @@ -101,16 +101,18 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.graph_widget.set(domain, group_by, col_group_by); }, + extract_groupby: function (cat_field, context) { + context = (_.isString(context)) ? py.eval(context) : context; + return context[cat_field]; + }, + get_groupbys_from_searchview: function (cat_name, cat_field) { - var facet = this.search_view.query.findWhere({category:cat_name}), + var self=this, + facet = this.search_view.query.findWhere({category:cat_name}), groupby_list = facet ? facet.values.models : []; return _.map(groupby_list, function (g) { var context = g.attributes.value.attrs.context; - if (_.isString(context)) { - return py.eval(context).group_by; - } else { - return context[cat_field]; - } + return self.extract_groupby(cat_field, context); }); }, -- cgit v1.2.3 From 9eda870d2b8bad1d2c480a9a54eb7264ce4df183 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Mon, 10 Feb 2014 12:23:13 +0100 Subject: [FIX] fixes a bug caused by two consecutive calls to do_search, with incomplete informations in the first call. These calls then triggered useless queries and caused an incorrect (but brief) display of partial information in graph view (addon web_graph) bzr revid: ged@openerp.com-20140210112313-z9elwhmjil41jcd2 --- addons/web_graph/static/src/js/graph_view.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index b39ac105ee4..33b99b88bcf 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -77,6 +77,11 @@ instance.web_graph.GraphView = instance.web.View.extend({ }, do_search: function (domain, context, group_by) { + if (this.ignore_do_search) { + this.ignore_do_search = false; + return; + } + var self = this, col_group_by = this.extract_groupby('col_group_by', context) || []; @@ -131,6 +136,14 @@ instance.web_graph.GraphView = instance.web.View.extend({ if (!_.has(this.search_view, '_s_groupby')) { return; } + if (row_groupby.length && col_groupby.length) { + // when two changes to the search view will be done, the method do_search + // will be called twice, once with the correct groupby and incorrect col_groupby, + // and once with correct informations. This flag is necessary to prevent the + // incorrect informations to propagate and trigger useless queries + this.ignore_do_search = true; + } + // add row groupbys var row_facet = this.make_row_groupby_facets(row_groupby), row_search_facet = query.findWhere({category:'GroupBy'}); -- cgit v1.2.3 From 321a4a74027364f709a9830faeba4d5a70a814fe Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Mon, 10 Feb 2014 16:32:21 +0100 Subject: [FIX] make sure the graph view takes the col_group_by from the search view and not from the context. It was taken from the context, and had the unfortunate side effect that the user could not ungroup by removing the facet from the search view. (addon web_graph) bzr revid: ged@openerp.com-20140210153221-olkv8xee02r9voer --- addons/web_graph/static/src/js/graph_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index 33b99b88bcf..ace2f14ae20 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -83,7 +83,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ } var self = this, - col_group_by = this.extract_groupby('col_group_by', context) || []; + col_group_by = self.get_groupbys_from_searchview('ColGroupBy', 'col_group_by'); if (!this.graph_widget) { if (group_by.length) { -- cgit v1.2.3 From 956b73998c3efa711e7d0f58ea3264d71b8286e6 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Tue, 25 Feb 2014 10:03:49 +0100 Subject: [FIX] fixes various problems with the search bar integration with the graph view. Now, the code correctly computes the group_bys and col_groupbys contained in the various filters in the search bar (addon web_graph) bzr revid: ged@openerp.com-20140225090349-z6udsjn0cjafu0lt --- addons/web_graph/static/src/js/graph_view.js | 41 ++++++++++++++++++---------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index e1a50d4ff6d..c29c78e7e33 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -50,7 +50,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ var field_name = field.attrs.name; if (_.has(field.attrs, 'interval')) { field_name = field.attrs.name + ':' + field.attrs.interval; - } + } if (_.has(field.attrs, 'type')) { switch (field.attrs.type) { case 'row': @@ -78,7 +78,8 @@ instance.web_graph.GraphView = instance.web.View.extend({ do_search: function (domain, context, group_by) { var self = this, - col_group_by = context.col_group_by || this.get_groupbys_from_searchview('ColGroupBy', 'col_group_by'); + groupbys = this.get_groupbys_dos(), + col_group_by = groupbys.col_group_by; if (!this.graph_widget) { if (group_by.length) { @@ -90,10 +91,10 @@ 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 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); + if (e === 'graph') { + var group_bys = self.get_groupbys_from_searchview(); + this.graph_widget.set(domain, group_bys.group_by, group_bys.col_group_by); + } }); return; } @@ -101,17 +102,27 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.graph_widget.set(domain, group_by, col_group_by); }, - 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) { - var context = g.attributes.value.attrs.context; - if (_.isString(context)) { - return py.eval(context).group_by; - } else { - return context[cat_field]; + get_groupbys_from_searchview: function () { + var result = { group_by: [], col_group_by: []}, + searchdata = this.search_view.build_search_data(); + + _.each(searchdata.groupbys, function (data) { + data = (_isString(data)) ? py.eval(data) : data; + result.group_by = result.group_by.concat(data.group_by); + if (data.col_group_by) { + result.col_group_by = result.col_group_by.concat(data.col_group_by); + } + }); + + if (result.col_group_by.length) { + return result; + } + _.each(searchdata.contexts, function (context) { + if (context.col_group_by) { + result.col_group_by = result.col_group_by.concat(context.col_group_by); } }); + return result; }, do_show: function () { -- cgit v1.2.3 From 02b70e2950c275e3bda3c172fdd72affa26d14b6 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Tue, 25 Feb 2014 11:31:55 +0100 Subject: [FIX] fixes problems due to the preceding merge (resolved conflict was not properly resolved) (addon web_graph) bzr revid: ged@openerp.com-20140225103155-9cdbs8p79sa7hkwi --- addons/web_graph/static/src/js/graph_view.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'addons/web_graph/static/src/js/graph_view.js') diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index 4e799c82afd..fa39fc581db 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -81,14 +81,9 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.ignore_do_search = false; return; } - var self = this, -<<<<<<< TREE - groupbys = this.get_groupbys_dos(), + groupbys = this.get_groupbys_from_searchview(), col_group_by = groupbys.col_group_by; -======= - col_group_by = self.get_groupbys_from_searchview('ColGroupBy', 'col_group_by'); ->>>>>>> MERGE-SOURCE if (!this.graph_widget) { if (group_by.length) { @@ -116,7 +111,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ searchdata = this.search_view.build_search_data(); _.each(searchdata.groupbys, function (data) { - data = (_isString(data)) ? py.eval(data) : data; + data = (_.isString(data)) ? py.eval(data) : data; result.group_by = result.group_by.concat(data.group_by); if (data.col_group_by) { result.col_group_by = result.col_group_by.concat(data.col_group_by); -- cgit v1.2.3