[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#82347 X-original-commit: 00965df4be591b952b339038c324d7e92596e3d5 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -177,7 +177,7 @@
|
||||
<t t-esc="access_name"/>
|
||||
</a>
|
||||
</div>
|
||||
<t t-if="'user_id' in record and record.user_id and not record.env.user._is_superuser()">
|
||||
<t t-if="'user_id' in record and record.user_id and not record.env.user._is_superuser() and signature != ''">
|
||||
<div style="margin: 0px; padding: 0px; font-size:13px;">
|
||||
Best regards,
|
||||
</div>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user