From d6e9bb5103afa533451adaa8aed9529bd3d23f44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 9 Dec 2011 12:19:47 +0100 Subject: [PATCH] Add missing converter to get_style_content of ir.action.report review203001 --- trytond/ir/action.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/trytond/ir/action.py b/trytond/ir/action.py index 1e2cad073f..8eb9179f9b 100644 --- a/trytond/ir/action.py +++ b/trytond/ir/action.py @@ -425,6 +425,12 @@ class ActionReport(ModelSQL, ModelView): def get_style_content(self, ids, name): res = {} + converter = buffer + default = False + format_ = Transaction().context.pop('%s.%s' % (self._name, name), '') + if format_ == 'size': + converter = len + default = 0 for report in self.browse(ids): try: with file_open( report.style.replace('/', os.sep), @@ -432,7 +438,7 @@ class ActionReport(ModelSQL, ModelView): data = fp.read() except Exception: data = False - res[report.id] = data + res[report.id] = converter(data) if data else default return res def get_pyson(self, ids, name):