diff --git a/addons/mail/data/mail_templates_email_layouts.xml b/addons/mail/data/mail_templates_email_layouts.xml
index 593fedf3722..890ea6c5f25 100644
--- a/addons/mail/data/mail_templates_email_layouts.xml
+++ b/addons/mail/data/mail_templates_email_layouts.xml
@@ -177,7 +177,7 @@
-
+
Best regards,
diff --git a/addons/test_mail/models/test_mail_models.py b/addons/test_mail/models/test_mail_models.py
index 61aab7393b2..a514b00f0cd 100644
--- a/addons/test_mail/models/test_mail_models.py
+++ b/addons/test_mail/models/test_mail_models.py
@@ -41,6 +41,11 @@ class MailTestStandard(models.Model):
container_id = fields.Many2one('mail.test.container', tracking=True)
company_id = fields.Many2one('res.company')
+ def _get_share_url(self, redirect, signup_partner, share_token):
+ """This function is required for a test on 'mail.mail_notification_paynow' template (test_message_post/test_mail_add_signature),
+ another model should be created in master"""
+ return '/mail/view'
+
class MailTestActivity(models.Model):
""" This model can be used to test activities in addition to simple chatter
diff --git a/addons/test_mail/tests/test_message_post.py b/addons/test_mail/tests/test_message_post.py
index f7c63a0e117..1f0b66c51aa 100644
--- a/addons/test_mail/tests/test_message_post.py
+++ b/addons/test_mail/tests/test_message_post.py
@@ -70,6 +70,31 @@ class TestMessagePost(TestMailCommon, TestRecipients):
user_email = self._new_mails.filtered(lambda mail: mail.recipient_ids == self.partner_employee)
self.assertTrue(user_email)
+ @users('employee')
+ def test_notify_mail_add_signature(self):
+ self.test_track = self.env['mail.test.track'].with_context(self._test_context).with_user(self.user_employee).create({
+ 'name': 'Test',
+ 'email_from': 'ignasse@example.com'
+ })
+ self.test_track.user_id = self.env.user
+
+ signature = self.env.user.signature
+
+ template = self.env.ref('mail.mail_notification_paynow', raise_if_not_found=True).sudo()
+ self.assertIn("record.user_id.sudo().signature", template.arch)
+
+ with self.mock_mail_gateway():
+ self.test_track.message_post(body="Test body", mail_auto_delete=False, add_sign=True, partner_ids=[self.partner_1.id, self.partner_2.id], email_layout_xmlid="mail.mail_notification_paynow")
+ found_mail = self._new_mails
+ self.assertIn(signature, found_mail.body_html)
+ self.assertEqual(found_mail.body_html.count(signature), 1)
+
+ with self.mock_mail_gateway():
+ self.test_track.message_post(body="Test body", mail_auto_delete=False, add_sign=False, partner_ids=[self.partner_1.id, self.partner_2.id], email_layout_xmlid="mail.mail_notification_paynow")
+ found_mail = self._new_mails
+ self.assertNotIn(signature, found_mail.body_html)
+ self.assertEqual(found_mail.body_html.count(signature), 0)
+
@users('employee')
def test_notify_prepare_template_context_company_value(self):
""" Verify that the template context company value is right