summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2014-01-27 16:23:24 +0100
committerGery Debongnie <ged@openerp.com>2014-01-27 16:23:24 +0100
commitf38017faecc1bf6e745ca1a330c584da7ac061af (patch)
tree3a8e1c8131ea864e19f99ee27ed48e7ec740a13b /addons/web_graph/static/src/js
parent3a784da01535759213803913cda01e9a19722c79 (diff)
[FIX] fixes a crash happening when the context has a groupby attributes which is an array (addon web_graph)
bzr revid: ged@openerp.com-20140127152324-n1jeyfjvii9dfeoh
Diffstat (limited to 'addons/web_graph/static/src/js')
-rw-r--r--addons/web_graph/static/src/js/graph_widget.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/addons/web_graph/static/src/js/graph_widget.js b/addons/web_graph/static/src/js/graph_widget.js
index 49ddb9388a0..454af202593 100644
--- a/addons/web_graph/static/src/js/graph_widget.js
+++ b/addons/web_graph/static/src/js/graph_widget.js
@@ -79,10 +79,18 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
return g instanceof openerp.web.search.GroupbyGroup;
});
- var filters = _.flatten(_.pluck(groupbygroups, 'filters'), true);
+ var filters = _.flatten(_.pluck(groupbygroups, 'filters'), true),
+ groupbys = _.flatten(_.map(filters, function (filter) {
+ var groupby = py.eval(filter.attrs.context).group_by;
+ if (!(groupby instanceof Array)) { groupby = [groupby]; }
+ return _.map(groupby, function(g) {
+ return {field: g, filter: filter};
+ });
+ }));
- return _.uniq(_.map(filters, function (filter) {
- var field = py.eval(filter.attrs.context).group_by,
+ return _.uniq(_.map(groupbys, function (groupby) {
+ var field = groupby.field,
+ filter = groupby.filter,
raw_field = field.split(':')[0],
string = (field === raw_field) ? filter.attrs.string : self.fields[raw_field].string;
@@ -465,7 +473,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
make_measure_row: function() {
var self = this,
cols = this.pivot.cols.headers,
- measure_cells,
measure_row = $('<tr>');
measure_row.append($('<th>'));