From dbf81af435382333d45290ce74da03aedcd7a80f Mon Sep 17 00:00:00 2001 From: Julien Banken Date: Tue, 27 Jul 2021 09:52:11 +0000 Subject: [PATCH] [FIX] website: prevent auto-filling the 'Contact Us' form with 'false' On the 'Contact us' form of the 'website' module, the client can auto-fill the fields with the 'false' text string when the logged partner has some missing values. This happens because the server set the missing values to 'false' and the client directly uses those values to update the form fields. To solve the issue, the client will replace the falsy values set by the server with an empty string before updating the form fields. That way, the form fields will no longer be filled with the 'false' text string. task-2610948 Fixes 116d55d62fd411d3be5d9f0885dadac530839b99 closes odoo/odoo#74256 Signed-off-by: Thibault Delavallee (tde) --- addons/website/static/src/snippets/s_website_form/000.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/static/src/snippets/s_website_form/000.js b/addons/website/static/src/snippets/s_website_form/000.js index 0ff6dd518f5..fe9c5021404 100644 --- a/addons/website/static/src/snippets/s_website_form/000.js +++ b/addons/website/static/src/snippets/s_website_form/000.js @@ -113,7 +113,7 @@ odoo.define('website.s_website_form', function (require) { if (!$field.val() && _.has(dataForValues, field) && dataForValues[field]) { $field.val(dataForValues[field]); } else if (!$field.val() && $field.data('fill-with')) { - $field.val(self.preFillValues[$field.data('fill-with')]); + $field.val(self.preFillValues[$field.data('fill-with')] || ''); } $field.data('website_form_original_default_value', $field.val()); });