Skip to content

[IMP] html_builder, *: fix default recipient email based on company email #4504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master-mysterious-egg
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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"];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion addons/website/tests/test_website_form_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def test_website_form_contact_us_edition_with_email(self):
'[email protected]',
'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 = '[email protected]'
self.start_tour('/odoo', 'website_form_contactus_edition_no_email', login="admin")
Expand Down