summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2014-02-25 10:13:10 +0100
committerGery Debongnie <ged@openerp.com>2014-02-25 10:13:10 +0100
commit893b7041f97a5f98dbb95affdfeecbcdb6db69ed (patch)
tree463444a7e755b66a6fb3f7aefc5c5f2b6a6bf074 /addons/web_graph/static/src/js
parent2ab61cf001fab1d30050598931bfa39956cf4883 (diff)
parenteaa20f9586f5d9a7a52ed5a7cc565d620e0ad44a (diff)
[MERGE] merge from trunk
bzr revid: ged@openerp.com-20140225091310-pzkj5ip17esl52kz
Diffstat (limited to 'addons/web_graph/static/src/js')
-rw-r--r--addons/web_graph/static/src/js/graph_view.js19
-rw-r--r--addons/web_graph/static/src/js/graph_widget.js42
2 files changed, 40 insertions, 21 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) {