[FIX] mail: attachments present for first recipient, but not for the others

attachments should be an array and not a generator [x for x in y] instead of (x for x in y)

bzr revid: dle@openerp.com-20140505123852-kjc6z0npiot9c54l
This commit is contained in:
Denis Ledoux 2014-05-05 14:38:52 +02:00
parent ce88158381
commit 4f1dbde8d5
1 changed files with 4 additions and 4 deletions

View File

@ -241,16 +241,16 @@ class mail_mail(osv.Model):
"""
ir_mail_server = self.pool.get('ir.mail_server')
ir_attachment = self.pool['ir.attachment']
for mail in self.browse(cr, SUPERUSER_ID, ids, context=context):
try:
# load attachment binary data with a separate read(), as prefetching all
# `datas` (binary field) could bloat the browse cache, triggerring
# soft/hard mem limits with temporary data.
attachment_ids = [a.id for a in mail.attachment_ids]
attachments = ((a['datas_fname'], base64.b64decode(a['datas']))
for a in ir_attachment.read(cr, uid, attachment_ids,
['datas_fname', 'datas']))
attachments = [(a['datas_fname'], base64.b64decode(a['datas']))
for a in ir_attachment.read(cr, SUPERUSER_ID, attachment_ids,
['datas_fname', 'datas'])]
# specific behavior to customize the send email for notified partners
email_list = []
if mail.email_to: