[FIX] mail: use base_url helper to be multi website compliant

When an email is sent and is related to a record, there is a header with a
button link to access the record.

Before this commit, that button href was always linking to the base_url URL.

That was an issue on multi-website, since we need to use the website url and
not the base_url if the record is related to a website.
That's the case for a SO eg, after checkout you receive a confirmation email.
In a multi-website environment, we need to access the record website.

To do so, a previous imp/fix was done with c1be1993f9.
But this occurence still needed to be replaced.

Fixes #34309

closes odoo/odoo#34397

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Romain Derie
2019-06-27 08:42:16 +00:00
parent b295723c99
commit d82b897ea1
+4
View File
@@ -694,6 +694,10 @@ class MailThread(models.AbstractModel):
params['token'] = token
link = '%s?%s' % (base_link, url_encode(params))
if self and hasattr(self, 'get_base_url'):
link = self[0].get_base_url() + link
return link
@api.multi