From 5353aa782b29a775e6b9c45d45fda0a2ecd8efb6 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 (transplanted from 6160399b1488a0aec2d36407e2e28c1eadfa9003) --- 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 d03c4a8e79..3122675385 100644 --- a/trytond/ir/action.py +++ b/trytond/ir/action.py @@ -401,6 +401,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), @@ -408,7 +414,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):