From d82b897ea15b7dd5eb9bc34687d9380f25f216f7 Mon Sep 17 00:00:00 2001 From: Romain Derie <rde@odoo.com> Date: Wed, 26 Jun 2019 16:52:44 +0000 Subject: [PATCH] [FIX] mail: use base_url helper to be multi website compliant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 c1be1993f9b. 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> --- addons/mail/models/mail_thread.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 41d35cc706d9..8ab60dbbb1c1 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -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 -- GitLab