[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) <tde@openerp.com>
This commit is contained in:
Julien Banken
2021-07-27 09:52:11 +00:00
parent 629719e53d
commit dbf81af435
@@ -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());
});