diff options
| author | Gery Debongnie <ged@openerp.com> | 2014-01-24 13:59:44 +0100 |
|---|---|---|
| committer | Gery Debongnie <ged@openerp.com> | 2014-01-24 13:59:44 +0100 |
| commit | 524324ae4e4ec21b58d2d3a89340d1d36173b260 (patch) | |
| tree | f128b0575e99faed2cf813eeb27a9c8433f341f9 /addons/web_graph/static/src/js/graph_widget.js | |
| parent | 29d08d9a6bc31b5ddaccaca78c97e9f093725069 (diff) | |
[FIX] fixes two small issues concerning the groupby dates in graph view (addon web_graph)
bzr revid: ged@openerp.com-20140124125944-wxl4zdya37pxdnqv
Diffstat (limited to 'addons/web_graph/static/src/js/graph_widget.js')
| -rw-r--r-- | addons/web_graph/static/src/js/graph_widget.js | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/addons/web_graph/static/src/js/graph_widget.js b/addons/web_graph/static/src/js/graph_widget.js index d9fd73924ee..6d8dc185243 100644 --- a/addons/web_graph/static/src/js/graph_widget.js +++ b/addons/web_graph/static/src/js/graph_widget.js @@ -23,7 +23,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ this.bar_ui = options.bar_ui || 'group'; this.graph_view = options.graph_view || null; this.pivot_options = options; - this.important_fields = this.get_search_fields(); }, start: function() { @@ -44,6 +43,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ return this.model.call('fields_get', []).then(function (f) { self.fields = f; self.fields.__count = {field:'__count', type: 'integer', string:'Quantity'}; + self.important_fields = self.get_search_fields(); self.measure_list = self.get_measures(); self.add_measures_to_options(); self.pivot_options.row_groupby = self.create_field_values(self.pivot_options.row_groupby || []); @@ -69,6 +69,7 @@ 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; var search_view = openerp.client.action_manager.inner_widget.searchview; var groupbygroups = _(search_view.inputs).select(function (g) { @@ -77,13 +78,15 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ var filters = [].concat.apply([], _.pluck(groupbygroups, 'filters')); - return _.map(filters, function (filter) { - return { - field: py.eval(filter.attrs.context).group_by, - string: filter.attrs.string, - filter: filter - }; - }); + return _.uniq(_.map(filters, function (filter) { + console.log(filter); + var field = py.eval(filter.attrs.context).group_by, + raw_field = field.split(':')[0], + string = (field === raw_field) ? filter.attrs.string : self.fields[raw_field].string, + filter = (field === raw_field) ? filter : undefined; + + return { field: raw_field, string: string, filter: filter }; + }), false, function (filter) {return filter.field;}); }, // Extracts the integer/float fields which are not 'id' @@ -281,10 +284,11 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ 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].type}; + return {id: field.field, value: field.string, type:self.fields[field.field.split(':')[0]].type}; }); + debugger; this.dropdown = $(QWeb.render('field_selection', {fields:fields, header_id:id})); $(event.target).after(this.dropdown); this.dropdown.css({position:'absolute', |
