}
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)
_defaults = {
"""
if 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')
res_id = values.get('res_id')
email_from = values.get('email_from')
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)
+ email_reply_to = message.reply_to
if not model:
model = message.model
if not res_id:
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 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]
# no alias reply_to -> reply_to will be the email_from, only the email part
if not email_reply_to and email_from:
else:
partner_ids = [partner_tree[partner.id] for partner in message.partner_ids
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 = []
for attachment in message.attachment_ids:
if attachment.id in attachments_tree:
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)
post_values['attachment_ids'] = attachment_ids
- post_values.update(email_dict)
# email_from: mass mailing only can specify another email_from
if email_dict.get('email_from'):
post_values['email_from'] = email_dict.pop('email_from')
# replies redirection: mass mailing only
if not wizard.same_thread:
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
# could be wrongly interpreted by mail_mail)
context.pop('default_email_to', None)