diff options
| author | Gery Debongnie <ged@openerp.com> | 2013-12-09 14:08:58 +0100 |
|---|---|---|
| committer | Gery Debongnie <ged@openerp.com> | 2013-12-09 14:08:58 +0100 |
| commit | 9f99fbdae7483ae8e73c4f6525ab8f3d23137126 (patch) | |
| tree | 0fb1fbe7a4939a65d3a5a68acdb681692e13854d /addons/web_graph/static/src/js/graph.js | |
| parent | 66c8114768376670408a856a3c10bb342b40de5e (diff) | |
[FIX] properly writes the col group_by in the context (with the facets) which allows the filter to work correctly, in graph view (addon web_graph)
bzr revid: ged@openerp.com-20131209130858-o8pqocw7otpqr8l0
Diffstat (limited to 'addons/web_graph/static/src/js/graph.js')
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index a5de9f2dde7..d64918aee56 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -44,12 +44,19 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.groupby_mode = 'default'; // 'default' or 'manual' this.default_row_groupby = []; this.search_field = { - get_context: function () { }, - get_domain: function () { }, + get_context: this.proxy('get_context'), + get_domain: function () {}, get_groupby: function () { }, }; }, + 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}; + }, + start: function () { this.table = $('<table></table>'); this.$('.graph_main_content').append(this.table); @@ -120,7 +127,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ do_search: function (domain, context, group_by) { var self = this, - col_groupby = get_col_groupby('ColGroupBy'); + col_groupby = context.col_group_by || []; // get_col_groupby('ColGroupBy'); if (group_by.length || col_groupby.length) { this.groupby_mode = 'manual'; @@ -135,19 +142,6 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.pivot_table.set_col_groupby([]); } this.display_data(); - - function get_col_groupby() { - var groupby = [], - search = _.find(self.search_view.query.models, function (model) { - return model.attributes.category == 'ColGroupBy'; - }); - if (search) { - groupby = _.map(search.values.models, function (val) { - return val.attributes.value.attrs.context.col_group_by; - }); - } - return groupby; - } }, do_show: function () { |
