[IMP] mail invite: add signature in invite and not in mail_mail
authorChristophe Matthieu <chm@openerp.com>
Thu, 3 Jan 2013 08:57:32 +0000 (09:57 +0100)
committerChristophe Matthieu <chm@openerp.com>
Thu, 3 Jan 2013 08:57:32 +0000 (09:57 +0100)
bzr revid: chm@openerp.com-20130103085732-p329g28wrslplfq3

addons/mail/mail_mail.py
addons/mail/wizard/invite.py

index f9fa06d..d6cb2a2 100644 (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):
index ee30530..11d072b 100644 (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'}
\ No newline at end of file