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 daa9f906d956c..e877ff560615c 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 @@ -31,6 +31,7 @@ import { replaceFieldElement, setActiveProperties, setVisibilityDependency, + getParsedDataFor, } from "./utils"; import { SyncCache } from "@html_builder/utils/sync_cache"; import { _t } from "@web/core/l10n/translation"; @@ -216,7 +217,11 @@ export class FormOptionPlugin extends Plugin { if (value && value !== this.defaultEmailToValue) { return value; } - return this.dataForEmailTo || this.defaultEmailToValue; + // 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); + return dataForValues["email_to"] || this.defaultEmailToValue } if (value) { return value; 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")