[MERGE][IMP] Enable HTML in emails signature

Closes #801
This commit is contained in:
Amit Vora 2014-06-27 11:31:24 +02:00 committed by Richard Mathot
parent 195fa93168
commit b592f9e13a
7 changed files with 13 additions and 15 deletions

View File

@ -48,7 +48,7 @@
<p>Thanks,</p>
<pre>
${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 ''}
</pre>
% if not ctx['partner_id'].user_id:
PS: It looks like you do not have an account manager assigned to you, please contact us.

View File

@ -33,7 +33,7 @@
<p>If you want more details, feel free to contact us by phone.</p>
<p>Kind regards,</p>
<br/>
${object.user_id and object.user_id.signature or ''}]]></field>
${object.user_id and object.user_id.signature | safe or ''}]]></field>
</record>
<record id="applicant_interest" model="email.template">
@ -51,7 +51,7 @@
If I do not answer, please let me a message with some schedules to call you back.</p>
<p>Kind regards,</p>
<br/>
${object.user_id.signature}]]></field>
${object.user_id.signature | safe}]]></field>
</record>
<!-- HR Recruitment Source -->

View File

@ -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 = "--<br />%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:')) \

View File

@ -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('<p>', 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('<p>', 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')

View File

@ -18,8 +18,8 @@
<field name="partner_id" ref="partner_demo_portal"/>
<field name="login">portal</field>
<field name="password">portal</field>
<field name="signature">--
Mr Demo Portal</field>
<field name="signature"><![CDATA[<span>--<br/>
Mr Demo Portal</span>]]></field>
<!-- Avoid auto-including this user in any default group -->
<field name="groups_id" eval="[(5,)]"/>
</record>

View File

@ -66,8 +66,8 @@
<field name="partner_id" ref="base.partner_root"/>
<field name="company_id" ref="main_company"/>
<field name="company_ids" eval="[(4, ref('main_company'))]"/>
<field name="signature">--
Administrator</field>
<field name="signature"><![CDATA[<span>--<br/>
Administrator</span>]]></field>
</record>
<record id="main_partner" model="res.partner">

View File

@ -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'),