[MERGE] [FIX] mail: mail composer: Use a text field instead of a html field

html fields are sanitized just before saving data into the database.
In the composer, this cause the sanitization of the templated
message (for mass mailing messages) before the rendering, forbidding
the use of templated html links.
The html of the message is sanitized by message_post()

bzr revid: chs@openerp.com-20130416083812-jvqeivfxhdr32djh
This commit is contained in:
Christophe Simonis 2013-04-16 10:38:12 +02:00
commit d7b63202f3
3 changed files with 9 additions and 2 deletions

View File

@ -155,7 +155,7 @@ class test_message_compose(TestMailBase):
message_pids = [partner.id for partner in compose.partner_ids]
partner_ids = [p_a_id]
self.assertEqual(compose.subject, '${object.name}', 'mail.compose.message subject incorrect')
self.assertEqual(compose.body, '<p>${object.description}</p>', 'mail.compose.message body incorrect')
self.assertEqual(compose.body, '${object.description}', 'mail.compose.message body incorrect')
self.assertEqual(set(message_pids), set(partner_ids), 'mail.compose.message partner_ids incorrect')
# 2. Post the comment, get created message

View File

@ -116,6 +116,13 @@ class mail_compose_message(osv.TransientModel):
'mail_compose_message_ir_attachments_rel',
'wizard_id', 'attachment_id', 'Attachments'),
'filter_id': fields.many2one('ir.filters', 'Filters'),
# Replace `body` with a text field because html fields are sanitized
# just before saving data into the database. This cause the
# sanitization of the templated messages (for mass mailing messages)
# before the rendering, forbidding the use of templated html links.
# The html of the message will be sanitized by message_post()
'body': fields.text('Contents'),
}
_defaults = {

View File

@ -30,7 +30,7 @@
</div>
<field name="subject" placeholder="Subject..."/>
</group>
<field name="body"/>
<field name="body" widget='html'/>
<field name="attachment_ids" widget="many2many_binary"/>
<footer>
<button string="Send" name="send_mail" type="object" class="oe_highlight"/>