summaryrefslogtreecommitdiff
path: root/addons/mail/wizard
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2015-10-01 10:43:32 +0200
committerThibault Delavallée <tde@openerp.com>2015-10-05 11:56:05 +0200
commit803bf8f75d239ccb7910cd2dca621b6a05e79289 (patch)
tree70b214058a7f60c1350dad3028f9cf3d3b0eb576 /addons/mail/wizard
parent2d5d2f0fe628f60901eb7d297b6cf44b4ca0be04 (diff)
[IMP] mail: invite email, notification style
Use the notification template when sending invite emails (add a follower with send a message checked).
Diffstat (limited to 'addons/mail/wizard')
-rw-r--r--addons/mail/wizard/invite.py24
1 files changed, 9 insertions, 15 deletions
diff --git a/addons/mail/wizard/invite.py b/addons/mail/wizard/invite.py
index 36736cb355d..b32d9dd657f 100644
--- a/addons/mail/wizard/invite.py
+++ b/addons/mail/wizard/invite.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from openerp import _, api, fields, models
-from openerp import tools
class Invite(models.TransientModel):
@@ -49,21 +48,16 @@ class Invite(models.TransientModel):
model_name = model_ids.name_get()[0][1]
# send an email if option checked and if a message exists (do not send void emails)
if wizard.send_mail and wizard.message and not wizard.message == '<br>': # when deleting the message, cleditor keeps a <br>
- # TDE FIXME: use a template + _notification methods
- # add signature
- signature = self.env.user.signature
- wizard.message = tools.append_content_to_html(wizard.message, signature, plaintext=False, container_tag='div')
-
- # send mail to new followers
- self.env['mail.mail'].create({
- 'model': wizard.res_model,
- 'res_id': wizard.res_id,
+ message = self.env['mail.message'].create({
+ 'subject': _('Invitation to follow %s: %s') % (model_name, document.name_get()[0][1]),
+ 'body': wizard.message,
'record_name': document.name_get()[0][1],
'email_from': email_from,
'reply_to': email_from,
- 'subject': _('Invitation to follow %s: %s') % (model_name, document.name_get()[0][1]),
- 'body_html': '%s' % wizard.message,
- 'auto_delete': True,
- 'message_id': self.env['mail.message']._get_message_id({'no_auto_thread': True}),
- 'recipient_ids': [(4, id) for id in new_partners.ids]}).send()
+ 'model': wizard.res_model,
+ 'res_id': wizard.res_id,
+ 'no_auto_thread': True,
+ })
+ new_partners.with_context(auto_delete=True)._notify(message, force_send=True, user_signature=True)
+ message.unlink()
return {'type': 'ir.actions.act_window_close'}