[IMP]:printscreen reports now use the context to not display invisible columns
bzr revid: nch@tinyerp.com-20100208060858-nzpogmt09a7h9wfm
This commit is contained in:
@@ -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 '')
|
||||
|
||||
Reference in New Issue
Block a user