[FIX] only Grouped field should appear in groupby clause, graph orientation corrected
authorJay (Open ERP) <jvo@tinyerp.com>
Wed, 14 Apr 2010 11:31:30 +0000 (17:01 +0530)
committerJay (Open ERP) <jvo@tinyerp.com>
Wed, 14 Apr 2010 11:31:30 +0000 (17:01 +0530)
lp bug: https://launchpad.net/bugs/559478 fixed

bzr revid: jvo@tinyerp.com-20100414113130-006eq3wcj82l4hgn

addons/base_report_creator/base_report_creator.py

index a546a65..83c4f74 100644 (file)
@@ -109,9 +109,11 @@ class report_creator(osv.osv):
             
         arch = '<?xml version="1.0" encoding="utf-8"?>\n'
         if view_type=='graph':
-            arch +='<graph string="%s" type="%s" orientation="%s">' % (report.name, report.view_graph_type,report.view_graph_orientation)
+            orientation_eval = {'horz':'horizontal','vert' :'vertical'}
+            orientation = eval(report.view_graph_orientation,orientation_eval)
+            arch +='<graph string="%s" type="%s" orientation="%s">' % (report.name, report.view_graph_type, orientation)
+            i = 0
             for val in ('x','y'):
-                i = 0
                 for f in report.field_ids:
                     if f.graph_mode==val:
                         if f.field_id.model:
@@ -348,7 +350,8 @@ class report_creator(osv.osv):
                     fields.append('\t'+t+'.'+f.field_id.name+' as field'+str(i))
                 else:
                     fields.append('\t'+f.group_method+'('+t+'.'+f.field_id.name+')'+' as field'+str(i))
-                groupby.append(t+'.'+f.field_id.name)
+                if f.group_method == 'group':
+                    groupby.append(t+'.'+f.field_id.name)
                 i+=1
             models = self._path_get(cr, uid, obj.model_ids, obj.filter_ids)
             check = self._id_get(cr, uid, ids[0], context)