From 38155143dc67cee86fef50af8e164f063e5413bb Mon Sep 17 00:00:00 2001 From: Hubert Van De Walle Date: Tue, 2 Jan 2024 15:58:47 +0100 Subject: [PATCH] [FIX] website: prevent crash in FormEditorRegistry if key not found Steps to reproduce ================== Go to Maintenance > Studio > Website > New Form Click on the website editor Click on the name field UncaughtPromiseError > KeyNotFoundError Cause of the issue ================== Starting from 17, the FormEditorRegistry is not the legacy one. If the key is not present in the registry, it will fail, unless we pass a default value. In this case, the key `website_form_key` is false. Solution ======== Pass null as the default value. opw-3652423 closes odoo/odoo#147840 Signed-off-by: Romain Derie (rde) --- addons/website/static/src/snippets/s_website_form/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/static/src/snippets/s_website_form/options.js b/addons/website/static/src/snippets/s_website_form/options.js index 97387d3023e..fa08489cbbe 100644 --- a/addons/website/static/src/snippets/s_website_form/options.js +++ b/addons/website/static/src/snippets/s_website_form/options.js @@ -629,7 +629,7 @@ options.registry.WebsiteFormEditor = FormEditor.extend({ // Add Action related options const formKey = this.activeForm.website_form_key; - const formInfo = FormEditorRegistry.get(formKey); + const formInfo = FormEditorRegistry.get(formKey, null); if (!formInfo || !formInfo.fields) { return; }