summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2012-08-21 23:24:19 +0200
committerOlivier Dony <odo@openerp.com>2012-08-21 23:24:19 +0200
commit95b13bdaa45d3bfbb178c679a6661b53b2f00205 (patch)
treed8aa5f72eea0a3954b70703a7ea543bacb85036a
parent5008e9cc84002797b2b4c8c43d10ab5e720bac8e (diff)
[FIX] *mail: s/mail_message/mail_mail/ for cases where a full mail_mail is necessary
bzr revid: odo@openerp.com-20120821212419-yu2criox6sayf2cv
-rw-r--r--addons/email_template/email_template.py10
-rw-r--r--addons/mail/mail_mail.py2
2 files changed, 6 insertions, 6 deletions
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index 84d48e1387a..291ddd6a0ef 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -389,12 +389,12 @@ class email_template(osv.osv):
:returns: id of the mail.message that was created
"""
if context is None: context = {}
- mail_message = self.pool.get('mail.message')
+ mail_mail = self.pool.get('mail.mail')
ir_attachment = self.pool.get('ir.attachment')
values = self.generate_email(cr, uid, template_id, res_id, context=context)
assert 'email_from' in values, 'email_from is missing or empty after template rendering, send_mail() cannot proceed'
attachments = values.pop('attachments') or {}
- msg_id = mail_message.create(cr, uid, values, context=context)
+ msg_id = mail_mail.create(cr, uid, values, context=context)
# link attachments
attachment_ids = []
for fname, fcontent in attachments.iteritems():
@@ -402,15 +402,15 @@ class email_template(osv.osv):
'name': fname,
'datas_fname': fname,
'datas': fcontent,
- 'res_model': mail_message._name,
+ 'res_model': mail_mail._name,
'res_id': msg_id,
}
context.pop('default_type', None)
attachment_ids.append(ir_attachment.create(cr, uid, attachment_data, context=context))
if attachment_ids:
- mail_message.write(cr, uid, msg_id, {'attachment_ids': [(6, 0, attachment_ids)]}, context=context)
+ mail_mail.write(cr, uid, msg_id, {'attachment_ids': [(6, 0, attachment_ids)]}, context=context)
if force_send:
- mail_message.send(cr, uid, [msg_id], context=context)
+ mail_mail.send(cr, uid, [msg_id], context=context)
return msg_id
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py
index 3d7c6fa2ec7..89f863ea2f8 100644
--- a/addons/mail/mail_mail.py
+++ b/addons/mail/mail_mail.py
@@ -174,7 +174,7 @@ class mail_mail(osv.Model):
if message.state == 'sent':
self._postprocess_sent_message(cr, uid, message, context=context)
except Exception:
- _logger.exception('failed sending mail.message %s', message.id)
+ _logger.exception('failed sending mail.mail %s', message.id)
message.write({'state':'exception'})
if auto_commit == True: