From 26bb317708897fb4c9e071fe06eb7bb1eb167f56 Mon Sep 17 00:00:00 2001 From: "Jurgen (jugj)" Date: Fri, 12 May 2023 12:43:35 +0000 Subject: [PATCH] [IMP] web : Open mail sender widget in a new window This PR aims to change the target of the email widget to _blank. Indeed depending on your mail provider, it can open the mail editor in your current tab and might not be practical for the user if he needs information that was present on the previous tab to compose the mail. task-3324948 closes odoo/odoo#121277 Signed-off-by: Luca Vitali --- addons/web/static/src/views/fields/email/email_field.xml | 1 + addons/web/static/tests/views/fields/email_field_tests.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/addons/web/static/src/views/fields/email/email_field.xml b/addons/web/static/src/views/fields/email/email_field.xml index 993a34b94a3..c9cad987fb6 100644 --- a/addons/web/static/src/views/fields/email/email_field.xml +++ b/addons/web/static/src/views/fields/email/email_field.xml @@ -27,6 +27,7 @@ t-if="props.record.data[props.name]" t-att-href="'mailto:'+props.record.data[props.name]" class="ms-3 d-inline-flex align-items-center" + target="_blank" > diff --git a/addons/web/static/tests/views/fields/email_field_tests.js b/addons/web/static/tests/views/fields/email_field_tests.js index a6e605526c6..5e131e1c781 100644 --- a/addons/web/static/tests/views/fields/email_field_tests.js +++ b/addons/web/static/tests/views/fields/email_field_tests.js @@ -75,6 +75,12 @@ QUnit.module("Fields", (hooks) => { "should have rendered the email button as a link with correct classes" ); assert.hasAttrValue(emailBtn, "href", "mailto:yop", "should have proper mailto prefix"); + assert.hasAttrValue( + emailBtn, + "target", + "_blank", + "should have target attribute set to _blank" + ); // change value in edit mode await editInput(target, ".o_field_email input[type='email']", "new");