diff --git a/addons/portal/mail_mail.py b/addons/portal/mail_mail.py index 813e31545e8..72c8469c042 100644 --- a/addons/portal/mail_mail.py +++ b/addons/portal/mail_mail.py @@ -29,8 +29,8 @@ class mail_mail_portal(osv.Model): _name = 'mail.mail' _inherit = ['mail.mail'] - def _generate_portal_url(self, cr, uid, partner_id, portal_group_id, key, context=None): - """ . """ + def _generate_signin_url(self, cr, uid, partner_id, portal_group_id, key, context=None): + """ Generate the signin url """ base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='', context=context) return base_url + '/login?action=signin&partner_id=%s&group=%s&key=%s' % (partner_id, portal_group_id, key) @@ -45,7 +45,7 @@ class mail_mail_portal(osv.Model): if partner: portal_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'portal', 'portal') portal_id = portal_ref and portal_ref[1] or False - url = self._generate_portal_url(cr, uid, partner.id, portal_id, 1234, context=context) + url = self._generate_signin_url(cr, uid, partner.id, portal_id, 1234, context=context) body = tools.append_content_to_html(mail.body_html, url) return body else: diff --git a/addons/portal/tests/test_portal.py b/addons/portal/tests/test_portal.py index 1f709ed3fa9..2c301228859 100644 --- a/addons/portal/tests/test_portal.py +++ b/addons/portal/tests/test_portal.py @@ -51,12 +51,19 @@ class test_portal(test_mail.TestMailMockups): p_b_id = self.res_partner.create(cr, uid, {'name': 'Bert Tartopoils', 'email': 'b@b'}) # ---------------------------------------- - # CASE1: invite Bert + # CASE1: generated URL + # ---------------------------------------- + + url = self.mail_mail._generate_signin_url(cr, uid, p_b_id, portal_id, 1234) + self.assertEqual(url, base_url + '/login?action=signin&partner_id=%s&group=%s&key=%s' % (p_b_id, portal_id, 1234), + 'generated signin URL incorrect') + + # ---------------------------------------- + # CASE2: invite Bert # ---------------------------------------- _sent_email_subject = 'Invitation to follow Pigs' - _sent_email_body = append_content_to_html('