[FIX] website_mass_mailing: hide thanks option for newsletter form

When configuring a Newsletter Block snippet to display a subscription
form, the option to decide whether a message must be displayed is only
available when "On Success" is set to "Show Message" through the button
beside that option.
Unfortunately, the general option for the "Thanks" message is not
disabled for other "On Success" values, for which no outcome can display
a message. Trying to combine these triggered an error.

This commit fixes this problem by hiding the "Display Thanks Button"
option when the "Form Subscription" template is selected.

Steps to produce:
- Install `website_mass_mailing`.
- Drop a "Newsletter Block" snippet.
- Change template to "Form Subscription".
- Click on "Subscribe" button.
- Change "On Success" to "Nothing".
- Click on "Display Thanks Button".

=> An error was displayed.

task-3748574

closes odoo/odoo#157739

X-original-commit: b090d68894fb96a73df230e021e516e6df22f40e
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit is contained in:
Benoit Socias
2024-03-18 07:04:10 +00:00
parent e214f6647a
commit 3eddcee5c1
@@ -107,6 +107,7 @@ options.registry.mailing_list_subscribe = options.Class.extend({
checkboxEl.setAttribute('string', _t("Display Thanks Button"));
checkboxEl.dataset.toggleThanksButton = 'true';
checkboxEl.dataset.noPreview = 'true';
checkboxEl.dataset.dependencies = "!form_opt";
uiFragment.appendChild(checkboxEl);
},
});