From e38974c5b62988c2887c0de0d2dbcb3526e6a214 Mon Sep 17 00:00:00 2001 From: Christophe Combelles Date: Sat, 13 Dec 2014 23:49:25 +0200 Subject: [PATCH] [FIX] mail: access link generaTION Catch only the error related to the access of the linked record. Previous was hidding error to access the ir.config_parameter and eventual other errors from the orm. Uses SUPERUSER_ID to access instance URL (e.g. portal has no access to it). Fixes #4234 #4234 --- addons/mail/mail_mail.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py index b71176bcd08..19852e1b182 100644 --- a/addons/mail/mail_mail.py +++ b/addons/mail/mail_mail.py @@ -179,7 +179,10 @@ class mail_mail(osv.Model): related_user = partner.user_ids[0] try: self.pool.get(mail.model).check_access_rule(cr, related_user.id, [mail.res_id], 'read', context=context) - base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') + except except_orm, e: + pass + else: + base_url = self.pool.get('ir.config_parameter').get_param(cr, SUPERUSER_ID, 'web.base.url') # the parameters to encode for the query and fragment part of url query = {'db': cr.dbname} fragment = { @@ -190,8 +193,6 @@ class mail_mail(osv.Model): url = urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment))) text = _("""

Access this document directly in OpenERP

""") % url body = tools.append_content_to_html(body, ("

%s

" % text), plaintext=False) - except except_orm, e: - pass return body def send_get_mail_reply_to(self, cr, uid, mail, partner=None, context=None):