[MERGE] merge nch fix for report window title

- the fix is based on a patch by Cristian Salamea

bzr revid: vmt@openerp.com-20110426103110-q92d4b5kxgfocsxd
This commit is contained in:
Vo Minh Thu 2011-04-26 12:31:10 +02:00
commit 4c5292d799
2 changed files with 4 additions and 2 deletions

View File

@ -49,6 +49,7 @@ class report_int(netsvc.Service):
self.name = name
self.id = 0
self.name2 = '.'.join(name.split('.')[1:])
# TODO the reports have methods with a 'title' kwarg that is redundant with this attribute
self.title = None
#self.joinGroup('report')
self.exportMethod(self.create)

View File

@ -67,11 +67,12 @@ class report_printscreen_list(report_int):
self.groupby_no_leaf = context.get('group_by_no_leaf',False)
pool = pooler.get_pool(cr.dbname)
model = pool.get(datas['model'])
# Title come from description of model which are specified in py file.
model_id = pool.get('ir.model').search(cr, uid, [('model','=',model._name)])
model_desc = model._description
if model_id:
model_desc = pool.get('ir.model').browse(cr, uid, model_id[0], context).name
self.title = model_desc
datas['ids'] = ids
model = pooler.get_pool(cr.dbname).get(datas['model'])
result = model.fields_view_get(cr, uid, view_type='tree', context=context)
fields_order = self.groupby + self._parse_string(result['arch'])
if self.groupby: