[FIX] web graphs for selections
authorFabien Pinckaers <fp@tinyerp.com>
Mon, 17 Sep 2012 16:37:40 +0000 (18:37 +0200)
committerFabien Pinckaers <fp@tinyerp.com>
Mon, 17 Sep 2012 16:37:40 +0000 (18:37 +0200)
bzr revid: fp@tinyerp.com-20120917163740-l6cb5dhpgyhl3c50

1  2 
addons/web_graph/controllers/graph.py

@@@ -52,7 -52,10 +52,10 @@@ class GraphView(View)
          def _convert(field, data, tick=True):
              if fields[field]['type']=='many2one':
                  data = data and data[1]
++            elif (fields[field]['type']=='selection') and (type(fields[field]['selection']) in (list, tuple)):
++                d = dict(fields[field]['selection'])
++                data = d[data]
              if tick:
 -                if fields[field]['type']=='selection':
 -                    d = dict(fields[field]['selection'])
 -                    data = d[data]
                  return ticks.setdefault(data, len(ticks))
              return data or 0