[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
This commit is contained in:
parent
5aa128c13a
commit
e38974c5b6
|
@ -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 = _("""<p>Access this document <a href="%s">directly in OpenERP</a></p>""") % url
|
||||
body = tools.append_content_to_html(body, ("<div><p>%s</p></div>" % text), plaintext=False)
|
||||
except except_orm, e:
|
||||
pass
|
||||
return body
|
||||
|
||||
def send_get_mail_reply_to(self, cr, uid, mail, partner=None, context=None):
|
||||
|
|
Loading…
Reference in New Issue