diff --git a/bin/addons/base/report/custom_new.xsl b/bin/addons/base/report/custom_new.xsl
index 6245865c262..5de13f4f010 100644
--- a/bin/addons/base/report/custom_new.xsl
+++ b/bin/addons/base/report/custom_new.xsl
@@ -92,7 +92,7 @@
-
+
@@ -102,6 +102,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bin/report/printscreen/ps_list.py b/bin/report/printscreen/ps_list.py
index 8582514b19f..543da8d33f1 100644
--- a/bin/report/printscreen/ps_list.py
+++ b/bin/report/printscreen/ps_list.py
@@ -71,14 +71,31 @@ class report_printscreen_list(report_int):
fields_order = self._parse_string(result['arch'])
rows = model.read(cr, uid, datas['ids'], result['fields'].keys(), context)
ids2 = [x['id'] for x in rows] # getting the ids from read result
-
if datas['ids'] != ids2: # sorted ids were not taken into consideration for print screen
rows_new = []
for id in datas['ids']:
element = [elem for elem in rows if elem['id']==id]
rows_new.append(element[0])
rows = rows_new
-
+ if context.get('group_by',False):
+ fields_order.remove(context['group_by'])
+ fields_order.insert(0, context['group_by'])
+ re = model.read_group(cr, uid, [], fields_order, context.get('group_by',False),0,None,context)
+ rows=[]
+ for r in re:
+ for f in fields_order:
+ if f not in r:
+ r.update({f:False})
+ if result['fields'][f]['type']=='many2one' and r[f]:
+ r.update({f:(r['__domain'][0][2],r[r['__domain'][0][0]])})
+ if result['fields'][f]['type'] == 'date' and r[f]:
+ r[f] = ''
+ r['__group']=True
+ rows.append(r)
+ _ids = model.search(cr, uid, r['__domain'])
+ res=model.read(cr, uid, _ids, result['fields'].keys(), context)
+ for r in res:
+ rows.append(r)
res = self._create_table(uid, datas['ids'], result['fields'], fields_order, rows, context, model_desc)
return (self.obj.get(), 'pdf')
@@ -182,8 +199,10 @@ class report_printscreen_list(report_int):
d1 = datetime.strptime(line[f], '%Y-%m-%d %H:%M:%S')
new_d1 = d1.strftime(format)
line[f] = new_d1
-
- col = etree.SubElement(node_line, 'col', para='yes', tree='no')
+ if line.get('__group'):
+ col = etree.SubElement(node_line, 'col', para='group', tree='no')
+ else:
+ col = etree.SubElement(node_line, 'col', para='yes', tree='no')
if line[f] != None:
col.text = tools.ustr(line[f] or '')
if float_flag:
@@ -215,7 +234,6 @@ class report_printscreen_list(report_int):
etree.parse(os.path.join(tools.config['root_path'],
'addons/base/report/custom_new.xsl')))
rml = etree.tostring(transform(new_doc))
-
self.obj = render.rml(rml, title=self.title)
self.obj.render()
return True