[FIX] don't break when a partner has a user

pull/422/head
Holger Brunn 2019-07-24 11:46:24 +02:00
parent dabb3bb7ff
commit 4168930283
No known key found for this signature in database
GPG Key ID: 5306CE414AFC231E
2 changed files with 11 additions and 0 deletions

View File

@ -68,3 +68,7 @@ class MailNotification(models.Model):
)
for a in etree.HTML(link_html or '<html/>').xpath('//a[@href]'):
this.record_access_link = a.get('href')
@api.model
def _get_access_link(self, mail, partner):
return self.env['mail.thread']._get_access_link(mail, partner)

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from mock import patch
from openerp.tests.common import TransactionCase
@ -22,3 +23,9 @@ class TestMailNotificationEmailTemplate(TransactionCase):
self.assertTrue(notifications)
# check that our template was used
self.assertTrue('<h2>Dear ' in n.body for n in notifications)
# check we can actually send our mail
with patch.object(
self.env['ir.mail_server'].__class__, 'send_email'
) as mock_send_email:
notifications.send()
mock_send_email.assert_called()