From fd94fbacb4c4a3fc8f01f43c587608369632e15b Mon Sep 17 00:00:00 2001 From: Harshad Modi Date: Tue, 18 Nov 2008 18:30:12 +0530 Subject: [PATCH] fixed bug : append datetime on file name after print report and resolve problem of open file bzr revid: hmo@tinyerp.com-20081118130012-11i9vtv48mdp7xoc --- bin/report/report_sxw.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index 203eca102c8..67f93fdb811 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -20,7 +20,7 @@ # ############################################################################## - +import base64 import xml.dom.minidom import os, time import ir, netsvc @@ -668,10 +668,10 @@ class report_sxw(report_rml): pdf = create_doc(rml2, logo,title) if attach: - # TODO: save multiple print with symbolic links in attach + # TODO: save multiple print with symbolic links in attach pool.get('ir.attachment').create(cr, uid, { - 'name': title or _('print'), - 'datas': pdf, + 'name': (title or _('print'))+':'+time.strftime('%Y-%m-%d %H:%M:%S'), + 'datas': base64.encodestring(pdf), 'datas_fname': attach+time.strftime('%Y-%m-%d')+'.'+report_type, 'res_model': self.table, 'res_id': ids[0]