[FIX] mail: attachments present for first recipient, but not for the others
authorDenis Ledoux <dle@openerp.com>
Mon, 5 May 2014 12:38:52 +0000 (14:38 +0200)
committerDenis Ledoux <dle@openerp.com>
Mon, 5 May 2014 12:38:52 +0000 (14:38 +0200)
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

addons/mail/mail_mail.py

index 0bd1537..1cc033e 100644 (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: