From caf01f9bb2181caea73438a7c2b4525bd6e30889 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Tue, 23 Jan 2024 14:02:24 +0100 Subject: [PATCH] [FIX] website: repair registry calls for model-based forms Since [1] when the legacy registry was replaced for website forms, model-based forms cannot be created anymore because the legacy registry getter returned a falsy value upon missing keys, while the new registry raises an error. Commit [2] already fixed one of the wrong calls but there were two other ones. This commit specifies a default values on the calls to the registry to avoid the error. [1]: https://github.com/odoo/odoo/commit/2d9f6fb32441b5db386e35200a5aab6b11b840dd#diff-59b3bc5742547152ea8d3248e1bd6606fbace25e572d7ca6c50c61e5847d184fL3-R3 [2]: https://github.com/odoo/odoo/commit/38155143dc67cee86fef50af8e164f063e5413bb opw-3677790 opw-3683466 closes odoo/odoo#150659 Signed-off-by: Romain Derie (rde) --- addons/website/static/src/snippets/s_website_form/options.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 51b8072c577..aa2c2a1b56e 100644 --- a/addons/website/static/src/snippets/s_website_form/options.js +++ b/addons/website/static/src/snippets/s_website_form/options.js @@ -785,14 +785,14 @@ options.registry.WebsiteFormEditor = FormEditor.extend({ if (modelId) { const oldFormKey = this.activeForm.website_form_key; if (oldFormKey) { - oldFormInfo = FormEditorRegistry.get(oldFormKey); + oldFormInfo = FormEditorRegistry.get(oldFormKey, null); } this.$target.find('.s_website_form_field').remove(); this.activeForm = this.models.find(model => model.id === modelId); currentActionName = this.activeForm.website_form_label; } const formKey = this.activeForm.website_form_key; - const formInfo = FormEditorRegistry.get(formKey); + const formInfo = FormEditorRegistry.get(formKey, null); // Success page if (!this.$target[0].dataset.successMode) { this.$target[0].dataset.successMode = 'redirect';