[IMP] mail invite: add signature in invite and not in mail_mail

bzr revid: chm@openerp.com-20130103085732-p329g28wrslplfq3
This commit is contained in:
Christophe Matthieu
2013-01-03 09:57:32 +01:00
parent ea7f6f2813
commit 992dbb2fbf
2 changed files with 8 additions and 5 deletions
-4
View File
@@ -78,10 +78,6 @@ class mail_mail(osv.Model):
def create(self, cr, uid, values, context=None):
if 'notification' not in values and values.get('mail_message_id'):
values['notification'] = True
user_id = self.pool.get("res.users").browse(cr, uid, uid, context=context)
signature = user_id and user_id.signature or ''
if signature:
values['body_html'] = tools.append_content_to_html(values['body_html'], signature, plaintext=True, container_tag='div')
return super(mail_mail, self).create(cr, uid, values, context=context)
def unlink(self, cr, uid, ids, context=None):
+8 -1
View File
@@ -19,6 +19,7 @@
#
##############################################################################
from openerp import tools
from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.translate import _
@@ -60,6 +61,12 @@ class invite_wizard(osv.osv_memory):
# send an email
if wizard.message:
#add signature
user_id = self.pool.get("res.users").browse(cr, uid, uid, context=context)
signature = user_id and user_id.signature or ''
if signature:
wizard.message = tools.append_content_to_html(wizard.message, signature, plaintext=True, container_tag='div')
# send mail to new followers
for follower_id in new_follower_ids:
mail_mail = self.pool.get('mail.mail')
# the invite wizard should create a private message not related to any object -> no model, no res_id
@@ -73,4 +80,4 @@ class invite_wizard(osv.osv_memory):
'model': False,
}, context=context)
mail_mail.send(cr, uid, [mail_id], recipient_ids=[follower_id], context=context)
return {'type': 'ir.actions.act_window_close'}
return {'type': 'ir.actions.act_window_close'}