[FIX] mail.compose.message: fixed reply_to from template in mass mailing.
bzr revid: tde@openerp.com-20130606142814-jyw76nhaeivotu6k
This commit is contained in:
parent
05d463a0e2
commit
a1e942c0de
|
@ -66,6 +66,9 @@ class mail_mail(osv.Model):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_default_from(self, cr, uid, context=None):
|
def _get_default_from(self, cr, uid, context=None):
|
||||||
|
""" Kept for compatibility
|
||||||
|
TDE TODO: remove me in 8.0
|
||||||
|
"""
|
||||||
return self.pool['mail.message']._get_default_from(cr, uid, context=context)
|
return self.pool['mail.message']._get_default_from(cr, uid, context=context)
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
@ -85,14 +88,15 @@ class mail_mail(osv.Model):
|
||||||
"""
|
"""
|
||||||
if values.get('reply_to'):
|
if values.get('reply_to'):
|
||||||
return values.get('reply_to')
|
return values.get('reply_to')
|
||||||
email_reply_to = False
|
|
||||||
|
|
||||||
# model, res_id: comes from values OR related message
|
# email_reply_to, model, res_id: comes from values OR related message
|
||||||
|
email_reply_to = False
|
||||||
model = values.get('model')
|
model = values.get('model')
|
||||||
res_id = values.get('res_id')
|
res_id = values.get('res_id')
|
||||||
email_from = values.get('email_from')
|
email_from = values.get('email_from')
|
||||||
if values.get('mail_message_id') and (not model or not res_id):
|
if values.get('mail_message_id') and (not model or not res_id):
|
||||||
message = self.pool.get('mail.message').browse(cr, uid, values.get('mail_message_id'), context=context)
|
message = self.pool.get('mail.message').browse(cr, uid, values.get('mail_message_id'), context=context)
|
||||||
|
email_reply_to = message.reply_to
|
||||||
if not model:
|
if not model:
|
||||||
model = message.model
|
model = message.model
|
||||||
if not res_id:
|
if not res_id:
|
||||||
|
@ -101,7 +105,7 @@ class mail_mail(osv.Model):
|
||||||
email_from = message.email_from
|
email_from = message.email_from
|
||||||
|
|
||||||
# if model and res_id: try to use ``message_get_reply_to`` that returns the document alias
|
# if model and res_id: try to use ``message_get_reply_to`` that returns the document alias
|
||||||
if model and res_id and hasattr(self.pool[model], 'message_get_reply_to'):
|
if not email_reply_to and model and res_id and hasattr(self.pool[model], 'message_get_reply_to'):
|
||||||
email_reply_to = self.pool[model].message_get_reply_to(cr, uid, [res_id], context=context)[0]
|
email_reply_to = self.pool[model].message_get_reply_to(cr, uid, [res_id], context=context)[0]
|
||||||
# no alias reply_to -> reply_to will be the email_from, only the email part
|
# no alias reply_to -> reply_to will be the email_from, only the email part
|
||||||
if not email_reply_to and email_from:
|
if not email_reply_to and email_from:
|
||||||
|
|
|
@ -352,9 +352,6 @@ class mail_message(osv.Model):
|
||||||
else:
|
else:
|
||||||
partner_ids = [partner_tree[partner.id] for partner in message.partner_ids
|
partner_ids = [partner_tree[partner.id] for partner in message.partner_ids
|
||||||
if partner.id in partner_tree]
|
if partner.id in partner_tree]
|
||||||
# for partner in message.notified_partner_ids:
|
|
||||||
# if partner.id in partner_tree:
|
|
||||||
# partner_ids.append(partner_tree[partner.id])
|
|
||||||
attachment_ids = []
|
attachment_ids = []
|
||||||
for attachment in message.attachment_ids:
|
for attachment in message.attachment_ids:
|
||||||
if attachment.id in attachments_tree:
|
if attachment.id in attachments_tree:
|
||||||
|
|
|
@ -259,13 +259,15 @@ class mail_compose_message(osv.TransientModel):
|
||||||
new_attach_id = ir_attachment_obj.copy(cr, uid, attach_id, {'res_model': self._name, 'res_id': wizard.id}, context=context)
|
new_attach_id = ir_attachment_obj.copy(cr, uid, attach_id, {'res_model': self._name, 'res_id': wizard.id}, context=context)
|
||||||
attachment_ids.append(new_attach_id)
|
attachment_ids.append(new_attach_id)
|
||||||
post_values['attachment_ids'] = attachment_ids
|
post_values['attachment_ids'] = attachment_ids
|
||||||
post_values.update(email_dict)
|
|
||||||
# email_from: mass mailing only can specify another email_from
|
# email_from: mass mailing only can specify another email_from
|
||||||
if email_dict.get('email_from'):
|
if email_dict.get('email_from'):
|
||||||
post_values['email_from'] = email_dict.pop('email_from')
|
post_values['email_from'] = email_dict.pop('email_from')
|
||||||
# replies redirection: mass mailing only
|
# replies redirection: mass mailing only
|
||||||
if not wizard.same_thread:
|
if not wizard.same_thread:
|
||||||
post_values['reply_to'] = email_dict.pop('reply_to')
|
post_values['reply_to'] = email_dict.pop('reply_to')
|
||||||
|
else:
|
||||||
|
email_dict.pop('reply_to')
|
||||||
|
post_values.update(email_dict)
|
||||||
# clean the context (hint: mass mailing sets some default values that
|
# clean the context (hint: mass mailing sets some default values that
|
||||||
# could be wrongly interpreted by mail_mail)
|
# could be wrongly interpreted by mail_mail)
|
||||||
context.pop('default_email_to', None)
|
context.pop('default_email_to', None)
|
||||||
|
|
Loading…
Reference in New Issue