From 93be43df7eadd33ac4c3c11ffbdf1cfd19642108 Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Mon, 8 Feb 2010 11:36:10 +0530 Subject: [PATCH] [IMP]:printscreen reports now use the context to not display invisible columns bzr revid: nch@tinyerp.com-20100208060610-h9bwn80541ic2m6x --- bin/report/printscreen/ps_list.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/report/printscreen/ps_list.py b/bin/report/printscreen/ps_list.py index 78729a571d5..8582514b19f 100644 --- a/bin/report/printscreen/ps_list.py +++ b/bin/report/printscreen/ps_list.py @@ -32,14 +32,16 @@ from datetime import datetime class report_printscreen_list(report_int): def __init__(self, name): report_int.__init__(self, name) + self.context = {} def _parse_node(self, root_node): result = [] for node in root_node: - if node.tag == 'field': - result.append(node.get('name')) - else: - result.extend(self._parse_node(node)) + if not eval(str(node.attrib.get('invisible',False)),{'context':self.context}): + if node.tag == 'field': + result.append(node.get('name')) + else: + result.extend(self._parse_node(node)) return result def _parse_string(self, view): @@ -52,6 +54,7 @@ class report_printscreen_list(report_int): def create(self, cr, uid, ids, datas, context=None): if not context: context={} + self.context = context pool = pooler.get_pool(cr.dbname) model = pool.get(datas['model']) model_id = pool.get('ir.model').search(cr, uid, [('model','=',model._name)]) @@ -64,7 +67,6 @@ class report_printscreen_list(report_int): 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._parse_string(result['arch']) rows = model.read(cr, uid, datas['ids'], result['fields'].keys(), context) @@ -180,7 +182,7 @@ 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[f] != None: col.text = tools.ustr(line[f] or '')