From 7e78e1f46fd5e4a60d5f6080d473be54ac661803 Mon Sep 17 00:00:00 2001
From: "Matheus Leal Viana (malv)" <malv@odoo.com>
Date: Tue, 1 Aug 2023 10:21:58 -0300
Subject: [PATCH] [FIX] website_crm_partner_assign: fixing broken urls in mail
 template
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Issue:
-------------------
In the lead forward mail template, there are some broken links, when we click on those links they are appended to the current url and redirect to a non-expected page.

Steps to reproduce:
-------------------
1. Go to CRM -> Create a new opportunity
2. Click on this new opportunity -> Assigned Partner
3. Select an assigned partner and click “Send Email”
4. Go to Settings -> Technical -> Emails
5. When clicking on “Partner Portal” it redirects to a non-existing page

Cause:
-------------------
The issue is happening because the urls are badly formatted and not using the correct tags

OPW-3074049

closes odoo/odoo#130300

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
---
 .../website_crm_partner_assign/data/mail_template_data.xml  | 6 +++---
 .../i18n/website_crm_partner_assign.pot                     | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/addons/website_crm_partner_assign/data/mail_template_data.xml b/addons/website_crm_partner_assign/data/mail_template_data.xml
index 344aa804c6ac..c5c435475096 100644
--- a/addons/website_crm_partner_assign/data/mail_template_data.xml
+++ b/addons/website_crm_partner_assign/data/mail_template_data.xml
@@ -40,7 +40,7 @@
                                 <li t-foreach="ctx['partner_leads']" t-as="lead"><a t-att-href="lead['lead_link']" t-out="lead['lead_id'].name or 'Subject Undefined'">Subject Undefined</a>, <t t-out="lead['lead_id'].partner_name or lead['lead_id'].contact_name or 'Contact Name Undefined'">Contact Name Undefined</t>, <t t-out="lead['lead_id'].country_id and lead['lead_id'].country_id.name or 'Country Undefined'">Country Undefined</t>, <t t-out="lead['lead_id'].email_from or 'Email Undefined' or ''">Email Undefined</t>, <t t-out="lead['lead_id'].phone or ''">+1 650-123-4567</t> </li><br/>
                             </ol>
                             <t t-if="ctx.get('partner_in_portal')">
-                                Please connect to your <a href="{{ record.get_portal_url() }}">Partner Portal</a> to get details. On each lead are two buttons on the top left corner that you should press after having contacted the lead: "I'm interested" &amp; "I'm not interested".<br/>
+                                Please connect to your <a t-att-href="'%s' % (object.get_base_url())">Partner Portal</a> to get details. On each lead are two buttons on the top left corner that you should press after having contacted the lead: "I'm interested" &amp; "I'm not interested".<br/>
                             </t>
                             <t t-else="">
                                 You do not have yet a portal access to our database. Please contact
@@ -74,9 +74,9 @@
                 <tr><td valign="middle" align="left" style="opacity: 0.7;">
                     <t t-out="user.company_id.phone or ''">+1 650-123-4567</t>
                     <t t-if="user.company_id.phone and (user.company_id.email or user.company_id.website)">|</t>
-                    <a t-if="user.company_id.email" t-attf-href="'mailto:%s' % {{ user.company_id.email }}" style="text-decoration:none; color: #454748;" t-out="user.company_id.email or ''">info@yourcompany.com</a>
+                    <a t-if="user.company_id.email" t-att-href="'mailto:%s' % user.company_id.email" style="text-decoration:none; color: #454748;" t-out="user.company_id.email or ''">info@yourcompany.com</a>
                     <t t-if="user.company_id.email and user.company_id.website">|</t>
-                    <a t-if="user.company_id.website" t-attf-href="'%s' % {{ user.company_id.website }}" style="text-decoration:none; color: #454748;" t-out="user.company_id.website or ''">http://www.example.com</a>
+                    <a t-if="user.company_id.website" t-att-href="'%s' % user.company_id.website" style="text-decoration:none; color: #454748;" t-out="user.company_id.website or ''">http://www.example.com</a>
                 </td></tr>
             </table>
         </td>
diff --git a/addons/website_crm_partner_assign/i18n/website_crm_partner_assign.pot b/addons/website_crm_partner_assign/i18n/website_crm_partner_assign.pot
index b2e1adbeed5d..bccd9cf9c757 100644
--- a/addons/website_crm_partner_assign/i18n/website_crm_partner_assign.pot
+++ b/addons/website_crm_partner_assign/i18n/website_crm_partner_assign.pot
@@ -247,7 +247,7 @@ msgid ""
 "                                <li t-foreach=\"ctx['partner_leads']\" t-as=\"lead\"><a t-att-href=\"lead['lead_link']\" t-out=\"lead['lead_id'].name or 'Subject Undefined'\">Subject Undefined</a>, <t t-out=\"lead['lead_id'].partner_name or lead['lead_id'].contact_name or 'Contact Name Undefined'\">Contact Name Undefined</t>, <t t-out=\"lead['lead_id'].country_id and lead['lead_id'].country_id.name or 'Country Undefined'\">Country Undefined</t>, <t t-out=\"lead['lead_id'].email_from or 'Email Undefined' or ''\">Email Undefined</t>, <t t-out=\"lead['lead_id'].phone or ''\">+1 650-123-4567</t> </li><br/>\n"
 "                            </ol>\n"
 "                            <t t-if=\"ctx.get('partner_in_portal')\">\n"
-"                                Please connect to your <a href=\"{{ record.get_portal_url() }}\">Partner Portal</a> to get details. On each lead are two buttons on the top left corner that you should press after having contacted the lead: \"I'm interested\" &amp; \"I'm not interested\".<br/>\n"
+"                                Please connect to your <a t-att-href=\"'%s' % (object.get_base_url())\">Partner Portal</a> to get details. On each lead are two buttons on the top left corner that you should press after having contacted the lead: \"I'm interested\" &amp; \"I'm not interested\".<br/>\n"
 "                            </t>\n"
 "                            <t t-else=\"\">\n"
 "                                You do not have yet a portal access to our database. Please contact\n"
@@ -281,9 +281,9 @@ msgid ""
 "                <tr><td valign=\"middle\" align=\"left\" style=\"opacity: 0.7;\">\n"
 "                    <t t-out=\"user.company_id.phone or ''\">+1 650-123-4567</t>\n"
 "                    <t t-if=\"user.company_id.phone and (user.company_id.email or user.company_id.website)\">|</t>\n"
-"                    <a t-if=\"user.company_id.email\" t-attf-href=\"'mailto:%s' % {{ user.company_id.email }}\" style=\"text-decoration:none; color: #454748;\" t-out=\"user.company_id.email or ''\">info@yourcompany.com</a>\n"
+"                    <a t-if=\"user.company_id.email\" t-att-href=\"'mailto:%s' % user.company_id.email\" style=\"text-decoration:none; color: #454748;\" t-out=\"user.company_id.email or ''\">info@yourcompany.com</a>\n"
 "                    <t t-if=\"user.company_id.email and user.company_id.website\">|</t>\n"
-"                    <a t-if=\"user.company_id.website\" t-attf-href=\"'%s' % {{ user.company_id.website }}\" style=\"text-decoration:none; color: #454748;\" t-out=\"user.company_id.website or ''\">http://www.example.com</a>\n"
+"                    <a t-if=\"user.company_id.website\" t-att-href=\"'%s' % user.company_id.website\" style=\"text-decoration:none; color: #454748;\" t-out=\"user.company_id.website or ''\">http://www.example.com</a>\n"
 "                </td></tr>\n"
 "            </table>\n"
 "        </td>\n"
-- 
GitLab