From b592f9e13aa292e6a4effb5607d4c3b2c90c0073 Mon Sep 17 00:00:00 2001 From: Amit Vora Date: Fri, 27 Jun 2014 11:31:24 +0200 Subject: [PATCH] [MERGE][IMP] Enable HTML in emails signature Closes #801 --- addons/crm_partner_assign/crm_partner_assign_data.xml | 2 +- addons/hr_recruitment/hr_recruitment_data.xml | 4 ++-- addons/mail/mail_followers.py | 5 ++--- addons/mail/tests/test_mail_features.py | 7 +++---- addons/portal/portal_demo.xml | 4 ++-- openerp/addons/base/base_data.xml | 4 ++-- openerp/addons/base/res/res_users.py | 2 +- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/addons/crm_partner_assign/crm_partner_assign_data.xml b/addons/crm_partner_assign/crm_partner_assign_data.xml index 284476cb6ee..cffee0a43ad 100644 --- a/addons/crm_partner_assign/crm_partner_assign_data.xml +++ b/addons/crm_partner_assign/crm_partner_assign_data.xml @@ -48,7 +48,7 @@

Thanks,

-${ctx['partner_id'].user_id and ctx['partner_id'].user_id.signature or ''}
+${ctx['partner_id'].user_id and ctx['partner_id'].user_id.signature | safe or ''}
 
% if not ctx['partner_id'].user_id: PS: It looks like you do not have an account manager assigned to you, please contact us. diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml index 5849a67d949..fdf5735bf8d 100644 --- a/addons/hr_recruitment/hr_recruitment_data.xml +++ b/addons/hr_recruitment/hr_recruitment_data.xml @@ -33,7 +33,7 @@

If you want more details, feel free to contact us by phone.

Kind regards,


- ${object.user_id and object.user_id.signature or ''}]]> + ${object.user_id and object.user_id.signature | safe or ''}]]> @@ -51,7 +51,7 @@ If I do not answer, please let me a message with some schedules to call you back.

Kind regards,


- ${object.user_id.signature}]]> + ${object.user_id.signature | safe}]]>
diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py index 23e7f6ae6aa..2045353b0e5 100644 --- a/addons/mail/mail_followers.py +++ b/addons/mail/mail_followers.py @@ -119,11 +119,10 @@ class mail_notification(osv.Model): # add user signature user = self.pool.get("res.users").browse(cr, SUPERUSER_ID, [user_id], context=context)[0] if user.signature: - signature = plaintext2html(user.signature) + signature = user.signature else: signature = "--
%s" % user.name - footer = tools.append_content_to_html(footer, signature, plaintext=False, container_tag='p') - + footer = tools.append_content_to_html(footer, signature, plaintext=False) # add company signature if user.company_id.website: website_url = ('http://%s' % user.company_id.website) if not user.company_id.website.lower().startswith(('http:', 'https:')) \ diff --git a/addons/mail/tests/test_mail_features.py b/addons/mail/tests/test_mail_features.py index 17836ea186c..2bf7bb91264 100644 --- a/addons/mail/tests/test_mail_features.py +++ b/addons/mail/tests/test_mail_features.py @@ -22,10 +22,9 @@ from openerp.addons.mail.mail_mail import mail_mail from openerp.addons.mail.mail_thread import mail_thread from openerp.addons.mail.tests.common import TestMail -from openerp.tools import mute_logger, email_split +from openerp.tools import mute_logger, email_split, html2plaintext from openerp.tools.mail import html_sanitize - class test_mail(TestMail): def test_000_alias_setup(self): @@ -474,7 +473,7 @@ class test_mail(TestMail): 'message_post: notification email body alternative should contain the body') self.assertNotIn('

', sent_email['body_alternative'], 'message_post: notification email body alternative still contains html') - self.assertIn(user_raoul.signature, sent_email['body_alternative'], + self.assertIn(html2plaintext(user_raoul.signature), sent_email['body_alternative'], 'message_post: notification email body alternative should contain the sender signature') self.assertFalse(sent_email['references'], 'message_post: references should be False when sending a message that is not a reply') @@ -545,7 +544,7 @@ class test_mail(TestMail): 'message_post: notification email body alternative should contain the body') self.assertNotIn('

', sent_email['body_alternative'], 'message_post: notification email body alternative still contains html') - self.assertIn(user_raoul.signature, sent_email['body_alternative'], + self.assertIn(html2plaintext(user_raoul.signature), sent_email['body_alternative'], 'message_post: notification email body alternative should contain the sender signature') self.assertIn(msg_message_id, sent_email['references'], 'message_post: notification email references lacks parent message message_id') diff --git a/addons/portal/portal_demo.xml b/addons/portal/portal_demo.xml index ab4876639ef..6cc1d6bd527 100644 --- a/addons/portal/portal_demo.xml +++ b/addons/portal/portal_demo.xml @@ -18,8 +18,8 @@ portal portal - -- -Mr Demo Portal + --
+Mr Demo Portal]]>
diff --git a/openerp/addons/base/base_data.xml b/openerp/addons/base/base_data.xml index 728f1d43647..5518b5c7621 100644 --- a/openerp/addons/base/base_data.xml +++ b/openerp/addons/base/base_data.xml @@ -66,8 +66,8 @@ - -- -Administrator + --
+Administrator]]>
diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index c84ff058cec..c814155d1db 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -172,7 +172,7 @@ class res_users(osv.osv): help="Specify a value only when creating a user or if you're "\ "changing the user's password, otherwise leave empty. After "\ "a change of password, the user has to login again."), - 'signature': fields.text('Signature'), + 'signature': fields.html('Signature'), 'active': fields.boolean('Active'), 'action_id': fields.many2one('ir.actions.actions', 'Home Action', help="If specified, this action will be opened at log on for this user, in addition to the standard menu."), 'groups_id': fields.many2many('res.groups', 'res_groups_users_rel', 'uid', 'gid', 'Groups'),