Skip to content
Browse files

[FIX] web: prevent browsers inputs autofill

We don't want the browser to fill inputs in the backend.
Most of the time this is useless but sometimes it is
even problematic. For example, focusing an input in a
modal can trigger autofill not only in the modal but
also in the whole page. If there is an input outside
the modal and it is recognized by the browser as a
candidate to fill, bad things occur.

For that reason, we set the attribute autocomplete to
"none" by default for input elements.
Note that "off" does not work all the time because
the browsers sometimes decide to ignore it.

Task ID: 2076730

closes #38039

Signed-off-by: VincentSchippefilt <>
  • Loading branch information...
Polymorphe57 committed Oct 3, 2019
1 parent 2b8f5dc commit 64293fbdb0a247f689c1b0b0c580d9ce577af510
Showing with 20 additions and 1 deletion.
  1. +1 −1 addons/web/static/src/js/fields/basic_fields.js
  2. +19 −0 addons/web/static/tests/views/form_tests.js
@@ -262,7 +262,7 @@ var InputField = DebouncedField.extend({
inputAttrs = _.extend(inputAttrs, { type: 'password', autocomplete: 'new-password' });
inputVal = this.value || '';
} else {
inputAttrs = _.extend(inputAttrs, { type: 'text', autocomplete: this.attrs.autocomplete });
inputAttrs = _.extend(inputAttrs, { type: 'text', autocomplete: this.attrs.autocomplete || 'none'});
inputVal = this._formatValue(this.value);

@@ -6637,6 +6637,25 @@ QUnit.module('Views', {

QUnit.test('input autocomplete attribute set to none by default', async function (assert) {

var form = await createView({
View: FormView,
model: 'partner',
arch: '<form string="Partners">' +
'<field name="display_name"/>' +
res_id: 1,

await testUtils.form.clickEdit(form);
assert.hasAttrValue(form.$('input[name="display_name"]'), 'autocomplete', 'none',
"attribute autocomplete should be set to none by default");

QUnit.test('context is correctly passed after save & new in FormViewDialog', async function (assert) {

0 comments on commit 64293fb

Please sign in to comment.
You can’t perform that action at this time.