[FIX] email_template: avoid double extension for report attachement

bzr revid: chs@openerp.com-20100806094411-rg9vx3ysnfwaeyji
This commit is contained in:
Christophe Simonis
2010-08-06 11:44:11 +02:00
parent cc429ca22b
commit 52afa5e307
+9 -9
View File
@@ -468,18 +468,18 @@ class email_template(osv.osv):
data,
context)
attachment_obj = self.pool.get('ir.attachment')
fname = tools.ustr(get_value(cursor, user, record_id,
template.file_name, template, context)
or 'Report')
ext = '.' + format
if not fname.endswith(ext):
fname += ext
new_att_vals = {
'name':mail.subject + ' (Email Attachment)',
'datas':base64.b64encode(result),
'datas_fname':tools.ustr(
get_value(
cursor,
user,
record_id,
template.file_name,
template,
context
) or 'Report') + "." + format,
'datas_fname': fname,
'description':mail.subject or "No Description",
'res_model':'email_template.mailbox',
'res_id':mail.id