summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2014-04-30 10:49:27 +0200
committerGery Debongnie <ged@openerp.com>2014-04-30 10:49:27 +0200
commit1f693aaed6f6e28a384f20d357f8a3f558d33f6a (patch)
treebebe272f8628c08e87a4d0d3395783b43f75cc6b /addons/web_graph/static/src
parent36e3aac85ef60e39371d848bebcac265981d87f2 (diff)
[FIX] fix a crash in graphview when user clicked rapidly twice on menu item
The issue was that the get_search_fields method tried to get the view's corresponding searchview after a rpc (fields_get). Sadly, if the user had meanwhile clicked again on the menu item, the first view would be detached from the view manager and would be unable to reach the search view. The solution is to move the lookup for the search view in the start method, where it is guaranteed to exist. bzr revid: ged@openerp.com-20140430084927-m11dxqg9ko0dnu08
Diffstat (limited to 'addons/web_graph/static/src')
-rw-r--r--addons/web_graph/static/src/js/graph_widget.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/addons/web_graph/static/src/js/graph_widget.js b/addons/web_graph/static/src/js/graph_widget.js
index d6f9b929dea..84ca75ddda2 100644
--- a/addons/web_graph/static/src/js/graph_widget.js
+++ b/addons/web_graph/static/src/js/graph_widget.js
@@ -43,6 +43,13 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
this.$('.graph_main_content').addClass('graph_pivot_mode');
}
+ // get search view
+ var parent = this.getParent();
+ while (!(parent instanceof openerp.web.ViewManager)) {
+ parent = parent.getParent();
+ }
+ this.search_view = parent.searchview;
+
openerp.session.rpc('/web_graph/check_xlwt').then(function (result) {
self.$('.graph_options_selection label').toggle(result);
});
@@ -76,16 +83,9 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
// this method gets the fields that appear in the search view, under the
// 'Groupby' heading
get_search_fields: function () {
- var self = this,
- parent = this.getParent();
-
- while (!(parent instanceof openerp.web.ViewManager)) {
- parent = parent.getParent();
- }
-
- var search_view = parent.searchview;
+ var self = this;
- var groupbygroups = _(search_view.inputs).select(function (g) {
+ var groupbygroups = _(this.search_view.inputs).select(function (g) {
return g instanceof openerp.web.search.GroupbyGroup;
});