[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) <rde@odoo.com>
This commit is contained in:
Benoit Socias
2024-01-24 10:44:39 +00:00
parent 1cc423954c
commit caf01f9bb2
@@ -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';