From 363251986dcd753796b4b037a2da2e118b3e8e35 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Thu, 3 Aug 2023 06:45:34 +0000 Subject: [PATCH] [REF] *: remove t-set of a property of an Object As all the templates are now imported in the owl app, the templates must comply to owl. t-set of a property of an Object is not allowed in owl. Part of task~3443861 Part-of: odoo/odoo#130467 --- .../src/snippets/s_website_form/options.js | 24 ++++++++++++++++++- .../static/src/xml/website_form_editor.xml | 19 --------------- 2 files changed, 23 insertions(+), 20 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 f6a2f3fad52..bd7f5c13a67 100644 --- a/addons/website/static/src/snippets/s_website_form/options.js +++ b/addons/website/static/src/snippets/s_website_form/options.js @@ -161,8 +161,28 @@ const FormEditor = options.Class.extend({ if (!field.id) { field.id = weUtils.generateHTMLId(); } + const params = { field: { ...field } }; + if (["url", "email", "tel"].includes(field.type)) { + params.field.inputType = field.type; + } + if (["boolean", "selection", "binary"].includes(field.type)) { + params.field.isCheck = true; + } + if (field.type === "one2many" && field.relation !== "ir.attachment") { + params.field.isCheck = true; + } + if (field.custom && !field.string) { + params.field.string = field.name; + } + if (field.type === "description") { + if (field.description) { + params.default_description = _t("Describe your field here."); + } else if (["email_cc", "email_to"].includes(field.name)) { + params.default_description = _t("Separate email addresses with a comma."); + } + } const template = document.createElement('template'); - template.content.append(renderToElement("website.form_field_" + field.type, {field: field})); + template.content.append(renderToElement("website.form_field_" + field.type, params)); if (field.description && field.description !== true) { $(template.content.querySelector('.s_website_form_field_description')).replaceWith(field.description); } @@ -674,6 +694,8 @@ options.registry.WebsiteFormEditor = FormEditor.extend({ field: { name: fieldName, value: value, + dnone: true, + formatInfo: {}, }, }); this.$target.find('.s_website_form_submit').before(hiddenField); diff --git a/addons/website/static/src/xml/website_form_editor.xml b/addons/website/static/src/xml/website_form_editor.xml index 606af9e8639..129a1aa7620 100644 --- a/addons/website/static/src/xml/website_form_editor.xml +++ b/addons/website/static/src/xml/website_form_editor.xml @@ -56,7 +56,6 @@ - @@ -69,15 +68,6 @@ - - - Describe your field here. - - - Separate email addresses with a comma. - - -
@@ -85,8 +75,6 @@ - - - - - @@ -230,7 +215,6 @@ -
- - -