[MERGE] graph issues fixes
authorXavier Morel <xmo@openerp.com>
Wed, 15 Feb 2012 09:24:22 +0000 (10:24 +0100)
committerXavier Morel <xmo@openerp.com>
Wed, 15 Feb 2012 09:24:22 +0000 (10:24 +0100)
bzr revid: xmo@openerp.com-20120215092422-0emfdu4cx3opuxxk

1  2 
addons/web_graph/static/src/js/graph.js

@@@ -216,9 -216,11 +216,11 @@@ openerp.web_graph.GraphView = openerp.w
                      .pluck(this.group_field)
                      .uniq()
                      .map(function (value, index) {
 -                        if(value)
 -                            value = value.toLowerCase().replace(/[\s\/]+/g,'_')
++                        if(value) {
++                            value = value.toLowerCase().replace(/[\s\/]+/g,'_');
++                        }
                          return {
--                            group: self.ordinate + '_' +
-                                     value.toLowerCase().replace(/[\s\/]+/g,'_'),
 -                                    value,
++                            group: _.str.sprintf('%s_%s', self.ordinate, value),
                              text: value,
                              color: COLOR_PALETTE[index % COLOR_PALETTE.length]
                          };
                      // second argument is coerced to a str, no good for boolean
                      r[self.abscissa] = records[0][self.abscissa];
                      _(records).each(function (record) {
-                         var key = _.str.sprintf('%s_%s',
-                             self.ordinate,
-                             record[self.group_field].toLowerCase().replace(/[\s\/]+/g,'_'));
 -                        if(record[self.group_field])
 -                            record[self.group_field] = record[self.group_field].toLowerCase().replace(/[\s\/]+/g,'_')
 -                        var key = _.str.sprintf('%s_%s',
 -                            self.ordinate,
 -                            record[self.group_field]);
++                        var value = record[self.group_field];
++                        if(value) {
++                            record[self.group_field] = value.toLowerCase().replace(/[\s\/]+/g,'_');
++                        }
++                        var key = _.str.sprintf('%s_%s', self.ordinate, value);
                          r[key] = record[self.ordinate];
                      });
                      return r;