From 246d0b60f2e9801f1368939de430d8e3f19c60d6 Mon Sep 17 00:00:00 2001 From: panv-odoo Date: Mon, 28 Apr 2025 18:36:23 +0530 Subject: [PATCH 1/2] [FIX] html_builder: fix default recipient email based on company email Prior to this commit, the default recipient email address used in the website form options was not being updated based on the company email. Instead, it was showing a placeholder/default email address. This commit fixes this issue by allowing the website form to use the default `email_to` from the company email. If the company email is not present, it will use the default email address. --- .../src/website_builder/plugins/form/form_option.js | 8 -------- .../website_builder/plugins/form/form_option_plugin.js | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/html_builder/static/src/website_builder/plugins/form/form_option.js b/addons/html_builder/static/src/website_builder/plugins/form/form_option.js index e23267b3e190a..015c7fce1699b 100644 --- a/addons/html_builder/static/src/website_builder/plugins/form/form_option.js +++ b/addons/html_builder/static/src/website_builder/plugins/form/form_option.js @@ -1,6 +1,5 @@ import { BaseOptionComponent, useDomState } from "@html_builder/core/utils"; import { onWillStart } from "@odoo/owl"; -import { getParsedDataFor } from "./utils"; import { FormActionFieldsOption } from "./form_action_fields_option"; import { session } from "@web/session"; @@ -58,12 +57,5 @@ export class FormOption extends BaseOptionComponent { activeForm, }; }); - // Get the email_to value from the data-for attribute if it exists. We - // use it if there is no value on the email_to input. - const formId = el.id; - const dataForValues = getParsedDataFor(formId, el.ownerDocument); - if (dataForValues) { - this.dataForEmailTo = dataForValues["email_to"]; - } } } diff --git a/addons/html_builder/static/src/website_builder/plugins/form/form_option_plugin.js b/addons/html_builder/static/src/website_builder/plugins/form/form_option_plugin.js index 2af537064b967..5c8de2a2a8dbd 100644 --- a/addons/html_builder/static/src/website_builder/plugins/form/form_option_plugin.js +++ b/addons/html_builder/static/src/website_builder/plugins/form/form_option_plugin.js @@ -30,6 +30,7 @@ import { replaceFieldElement, setActiveProperties, setVisibilityDependency, + getParsedDataFor, } from "./utils"; import { SyncCache } from "@html_builder/utils/sync_cache"; import { _t } from "@web/core/l10n/translation"; @@ -207,6 +208,13 @@ export class FormOptionPlugin extends Plugin { if (value && value !== this.defaultEmailToValue) { return value; } + // Get the email_to value from the data-for attribute if it exists. + // We use it if there is no value on the email_to input. + const formId = el.id; + const dataForValues = getParsedDataFor(formId, el.ownerDocument); + if (dataForValues) { + this.dataForEmailTo = dataForValues["email_to"]; + } return this.dataForEmailTo || this.defaultEmailToValue; } if (value) { From bbee83a5e432d6660f030bcd5949e3144411f4e7 Mon Sep 17 00:00:00 2001 From: panv-odoo Date: Tue, 29 Apr 2025 14:36:12 +0530 Subject: [PATCH 2/2] [IMP] website: Adapt and enable website tours Enabled following tours: - website_form_contactus_edition_no_email - website_form_contactus_submit --- addons/website/tests/test_website_form_editor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/website/tests/test_website_form_editor.py b/addons/website/tests/test_website_form_editor.py index ac2f09998103a..8aeb2d3c51f2c 100644 --- a/addons/website/tests/test_website_form_editor.py +++ b/addons/website/tests/test_website_form_editor.py @@ -36,7 +36,6 @@ def test_website_form_contact_us_edition_with_email(self): 'test@test.test', 'The email was edited, the form should have been sent to the configured email') - @unittest.skip def test_website_form_contact_us_edition_no_email(self): self.env.company.email = 'website_form_contactus_edition_no_email@mail.com' self.start_tour('/odoo', 'website_form_contactus_edition_no_email', login="admin")