fixed bug : append datetime on file name after print report and resolve problem of open file

bzr revid: hmo@tinyerp.com-20081118130012-11i9vtv48mdp7xoc
This commit is contained in:
Harshad Modi 2008-11-18 18:30:12 +05:30
parent 0d5946419b
commit fd94fbacb4
1 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@
# #
############################################################################## ##############################################################################
import base64
import xml.dom.minidom import xml.dom.minidom
import os, time import os, time
import ir, netsvc import ir, netsvc
@ -668,10 +668,10 @@ class report_sxw(report_rml):
pdf = create_doc(rml2, logo,title) pdf = create_doc(rml2, logo,title)
if attach: 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, { pool.get('ir.attachment').create(cr, uid, {
'name': title or _('print'), 'name': (title or _('print'))+':'+time.strftime('%Y-%m-%d %H:%M:%S'),
'datas': pdf, 'datas': base64.encodestring(pdf),
'datas_fname': attach+time.strftime('%Y-%m-%d')+'.'+report_type, 'datas_fname': attach+time.strftime('%Y-%m-%d')+'.'+report_type,
'res_model': self.table, 'res_model': self.table,
'res_id': ids[0] 'res_id': ids[0]