diff options
Diffstat (limited to 'addons/web_graph/static')
| -rw-r--r-- | addons/web_graph/static/src/js/graph_view.js | 19 | ||||
| -rw-r--r-- | addons/web_graph/static/src/js/graph_widget.js | 42 | ||||
| -rw-r--r-- | addons/web_graph/static/src/xml/web_graph.xml | 3 |
3 files changed, 40 insertions, 24 deletions
diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index c29c78e7e33..4e799c82afd 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -77,16 +77,25 @@ 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, +<<<<<<< TREE groupbys = this.get_groupbys_dos(), 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) { 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); @@ -140,6 +149,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'}); diff --git a/addons/web_graph/static/src/js/graph_widget.js b/addons/web_graph/static/src/js/graph_widget.js index 51baabaff5e..9e4c81157d1 100644 --- a/addons/web_graph/static/src/js/graph_widget.js +++ b/addons/web_graph/static/src/js/graph_widget.js @@ -263,9 +263,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ case 'swap_axis': this.swap_axis(); break; - case 'expand_all': - this.pivot.expand_all().then(this.proxy('display_data')); - break; case 'update_values': this.pivot.update_data().then(this.proxy('display_data')); break; @@ -295,25 +292,30 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ if (header.expanded) { this.fold(header); - } else { - if (header.path.length < header.root.groupby.length) { - this.expand(id); - } else { - if (!this.important_fields.length) { - return; - } + return; + } + if (header.path.length < header.root.groupby.length) { + this.expand(id); + return; + } + if (!this.important_fields.length) { + return; + } - var fields = _.map(this.important_fields, function (field) { - return {id: field.field, value: field.string, type:self.fields[field.field.split(':')[0]].type}; - }); - this.dropdown = $(QWeb.render('field_selection', {fields:fields, header_id:id})); - $(event.target).after(this.dropdown); - this.dropdown.css({position:'absolute', - left:event.pageX, - top:event.pageY}); - this.$('.field-selection').next('.dropdown-menu').toggle(); - } + var fields = _.map(this.important_fields, function (field) { + return {id: field.field, value: field.string, type:self.fields[field.field.split(':')[0]].type}; + }); + if (this.dropdown) { + this.dropdown.remove(); } + this.dropdown = $(QWeb.render('field_selection', {fields:fields, header_id:id})); + $(event.target).after(this.dropdown); + this.dropdown.css({position:'absolute', + left:event.pageX, + top:event.pageY}); + this.$('.field-selection').next('.dropdown-menu').toggle(); + + }, field_selection: function (event) { diff --git a/addons/web_graph/static/src/xml/web_graph.xml b/addons/web_graph/static/src/xml/web_graph.xml index 81804e5a9b1..4522fd2504f 100644 --- a/addons/web_graph/static/src/xml/web_graph.xml +++ b/addons/web_graph/static/src/xml/web_graph.xml @@ -35,9 +35,6 @@ <label class="btn btn-default" data-choice="swap_axis" title="Swap Axis"> <span class="fa fa-expand"></span> </label> - <label class="btn btn-default" data-choice="expand_all" title="Expand All"> - <span class="fa fa-arrows-alt"></span> - </label> <label class="btn btn-default" data-choice="update_values" title="Reload Data"> <span class="fa fa-refresh"></span> </label> |
