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) { 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")