[FIX] fix context problem in graph view
authorGéry Debongnie <ged@odoo.com>
Fri, 26 Sep 2014 09:38:06 +0000 (11:38 +0200)
committerGéry Debongnie <ged@odoo.com>
Fri, 26 Sep 2014 09:43:59 +0000 (11:43 +0200)
The group_by query expects the context to have group_by_no_leaf = true,
so we can not just blindly forward the context to the groupby query.
This is a defensive way to fix the problem, to avoid other possible
crashes.  But the context shouldn't have group_by_no_leaf anyway,
it does not make sense to explicitely do that in the action

addons/web_graph/static/src/js/graph_view.js

index b4b2fb3..ed8711f 100644 (file)
@@ -86,7 +86,8 @@ instance.web_graph.GraphView = instance.web.View.extend({
             col_group_by = groupbys.col_group_by;
 
         if (!this.graph_widget) {
-            this.widget_config.context = context;
+            this.widget_config.context = _.clone(context);
+            this.widget_config.context.group_by_no_leaf = true;
             if (group_by.length) {
                 this.widget_config.row_groupby = group_by;
             }