From 230b8258a551010080dd582923afe5a2f91d644b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Hello ${object.name}
', - 'mailing_model_id': self.env['ir.model']._get('res.partner').id, - }) - mailing_test = self.env['mailing.mailing.test'].create({ - 'email_to': 'test@test.com', - 'mass_mailing_id': mailing.id, - }) - - with self.mock_mail_gateway(): - mailing_test.send_mail_test() - - # Test if bad jinja in the subject raises an error - mailing.write({'subject': 'Subject ${object.name_id.id}'}) - with self.mock_mail_gateway(), self.assertRaises(Exception): - mailing_test.send_mail_test() - - # Test if bad jinja in the body raises an error - mailing.write({ - 'subject': 'Subject ${object.name}', - 'body_html': 'Hello ${object.name_id.id}
', - }) - with self.mock_mail_gateway(), self.assertRaises(Exception): - mailing_test.send_mail_test() - - # Test if bad jinja in the preview raises an error - mailing.write({ - 'body_html': 'Hello ${object.name}
', - 'preview': 'Preview ${object.name_id.id}', - }) - with self.mock_mail_gateway(), self.assertRaises(Exception): - mailing_test.send_mail_test() - - def test_mailing_trace_update(self): - customers = self.env['res.partner'] - for x in range(0, 3): - customers |= self.env['res.partner'].create({ - 'name': 'Customer_%02d' % x, - 'email': '"Customer_%02d"Hello ${object.name}
', + 'mailing_model_id': self.env['ir.model']._get('res.partner').id, + }) + mailing_test = self.env['mailing.mailing.test'].create({ + 'email_to': 'test@test.com', + 'mass_mailing_id': mailing.id, + }) + + with self.mock_mail_gateway(): + mailing_test.send_mail_test() + + # Test if bad jinja in the subject raises an error + mailing.write({'subject': 'Subject ${object.name_id.id}'}) + with self.mock_mail_gateway(), self.assertRaises(Exception): + mailing_test.send_mail_test() + + # Test if bad jinja in the body raises an error + mailing.write({ + 'subject': 'Subject ${object.name}', + 'body_html': 'Hello ${object.name_id.id}
', + }) + with self.mock_mail_gateway(), self.assertRaises(Exception): + mailing_test.send_mail_test() + + # Test if bad jinja in the preview raises an error + mailing.write({ + 'body_html': 'Hello ${object.name}
', + 'preview': 'Preview ${object.name_id.id}', + }) + with self.mock_mail_gateway(), self.assertRaises(Exception): + mailing_test.send_mail_test() From b36b74fa570937795c598a9f08086b13ff7773c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=Attached files :
'), 'model': model_name, 'message_type': 'comment', - 'no_auto_thread': False, 'res_id': id_record, 'attachment_ids': [(6, 0, orphan_attachment_ids)], 'subtype_id': request.env['ir.model.data'].xmlid_to_res_id('mail.mt_comment'), diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 5c867047313..6e3433e9fa7 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -109,7 +109,6 @@ class WebsiteSaleForm(WebsiteForm): 'body': nl2br(data['custom']), 'model': 'sale.order', 'message_type': 'comment', - 'no_auto_thread': False, 'res_id': order.id, } request.env['mail.message'].with_user(SUPERUSER_ID).create(values) From c8aabac87d8098c4f532f0dc2e7f069df8e33bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
diff --git a/addons/mass_mailing_sale/data/mass_mailing_demo.xml b/addons/mass_mailing_sale/data/mass_mailing_demo.xml
index c1872022fa3..d80d975c1e9 100644
--- a/addons/mass_mailing_sale/data/mass_mailing_demo.xml
+++ b/addons/mass_mailing_sale/data/mass_mailing_demo.xml
@@ -11,7 +11,7 @@
|