[FIX] mail: attachments encoding issue: posting process
waits not encoded attachments: email_template encodes them. So de-encoding is necessary. bzr revid: tde@openerp.com-20131126120336-5lcp9ii7z9lru5vr
This commit is contained in:
parent
cf214ed724
commit
974675bcbf
|
@ -19,6 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import base64
|
||||
import re
|
||||
|
||||
from openerp import tools
|
||||
|
@ -261,7 +262,6 @@ class mail_compose_message(osv.TransientModel):
|
|||
|
||||
for res_id, mail_values in all_mail_values.iteritems():
|
||||
if mass_mail_mode and not wizard.post:
|
||||
# process attachments and attachment_ids before sending values to mail_mail.Lcreat
|
||||
m2m_attachment_ids = self.pool['mail.thread']._message_preprocess_attachments(
|
||||
cr, uid, mail_values.pop('attachments', []),
|
||||
mail_values.pop('attachment_ids', []),
|
||||
|
@ -306,7 +306,12 @@ class mail_compose_message(osv.TransientModel):
|
|||
if mass_mail_mode and wizard.model:
|
||||
email_dict = rendered_values[res_id]
|
||||
mail_values['partner_ids'] += email_dict.pop('partner_ids', [])
|
||||
mail_values['attachments'] = email_dict.pop('attachments', [])
|
||||
# process attachments and attachment_ids before sending values to mail_mail.create()
|
||||
attachments = []
|
||||
if email_dict.get('attachments'):
|
||||
for name, enc_cont in email_dict.pop('attachments'):
|
||||
attachments.append((name, base64.b64decode(enc_cont)))
|
||||
mail_values['attachments'] = attachments
|
||||
attachment_ids = []
|
||||
for attach_id in mail_values.pop('attachment_ids'):
|
||||
new_attach_id = self.pool.get('ir.attachment').copy(cr, uid, attach_id, {'res_model': self._name, 'res_id': wizard.id}, context=context)
|
||||
|
|
Loading…
Reference in New Issue