From 4c31e5a994b1aa79dcd64dfa2deb48441b50dd2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 22 Jun 2009 10:54:13 +0200 Subject: [PATCH] Use the report name to create the temporary file to open it --- CHANGELOG | 1 + tryton/action/main.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index dd54b4a58a..1373a58e18 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Use the report name to create the temporary file to open it * Allow to store wizard size * Add reset default on fields * Store in config default width and height of main window diff --git a/tryton/action/main.py b/tryton/action/main.py index f882786032..98d3803ea0 100644 --- a/tryton/action/main.py +++ b/tryton/action/main.py @@ -50,11 +50,12 @@ class Action(object): return False if not res: return False - (type, data, print_p) = res + (type, data, print_p, name) = res if not print_p and direct_print: print_p = True - (fileno, fp_name) = tempfile.mkstemp('.' + type, 'tryton_') - file_d = os.fdopen(fileno, 'wb+') + dtemp = tempfile.mkdtemp(prefix='tryton_') + fp_name = os.path.join(dtemp, name + '.' + type) + file_d = open(fp_name, 'w') file_d.write(base64.decodestring(data)) file_d.close() if email_print: