Skip to content
Snippets Groups Projects
Commit 4b00548e authored by roen-odoo's avatar roen-odoo
Browse files

[FIX] mail : Remove double signature on invoice email


Current behavior :
When sending an invoice by email there was 2 signature in the mail

Steps to reproduce :
Create an invoice
Send it by email
Check the mail, there are 2 signatures

opw-2703272

closes odoo/odoo#81086

Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
parent 36d2643e
No related branches found
No related tags found
No related merge requests found
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
<t t-esc="access_name"/> <t t-esc="access_name"/>
</a> </a>
</div> </div>
<t t-if="record.user_id and not record.env.user._is_superuser()"> <t t-if="record.user_id and not record.env.user._is_superuser() and signature != ''">
<div style="margin: 0px; padding: 0px; font-size:13px;"> <div style="margin: 0px; padding: 0px; font-size:13px;">
Best regards, Best regards,
</div> </div>
......
...@@ -41,6 +41,11 @@ class MailTestStandard(models.Model): ...@@ -41,6 +41,11 @@ class MailTestStandard(models.Model):
container_id = fields.Many2one('mail.test.container', tracking=True) container_id = fields.Many2one('mail.test.container', tracking=True)
company_id = fields.Many2one('res.company') 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): class MailTestActivity(models.Model):
""" This model can be used to test activities in addition to simple chatter """ This model can be used to test activities in addition to simple chatter
......
...@@ -36,6 +36,31 @@ class TestMessagePost(TestMailCommon, TestRecipients): ...@@ -36,6 +36,31 @@ class TestMessagePost(TestMailCommon, TestRecipients):
messageId = call_kw(self.env['mail.channel'], 'message_post', [test_channel.id], {'body': 'test'}) messageId = call_kw(self.env['mail.channel'], 'message_post', [test_channel.id], {'body': 'test'})
self.assertTrue(isinstance(messageId, int)) self.assertTrue(isinstance(messageId, int))
@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') @users('employee')
def test_notify_prepare_template_context_company_value(self): def test_notify_prepare_template_context_company_value(self):
""" Verify that the template context company value is right """ Verify that the template context company value is right
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment