Odoo Help

0

Disable autofill on password field

By
Roy Nurmi
on 10/27/16, 12:58 AM 758 views

I have a custom module where user has to enter password(s) for external services. Password field is named password and shown in password field like this:

<field name="password" password="True"/>

The problem is Chrome autofill that always tries to fill the field with user password to the Odoo itself. And this happens always, when a form is opened to edit mode. Is there any mechanism to prevent browser autofill mechanism with fields?

1
Ahmed M.Elmubarak
On 10/27/16, 3:12 AM

Hi,

IMHO, I think there is no direct clean way to prevent the browser to autofill password field.

Actually now the browsers ignoring the autocomplete="off" attribute. 

So I think the only workaround 'that I can come up with' is to add another fake password field; and just add it above your original password field. The browser will be confused when there is two password fields in the same block; so it will left them empty along with the name or email field .. 

I know we need to make the fake password some how invisible but actually the Odoo's invisible='1', will not achieve the desired result [it also equivalent to style="display:none"] the browser will still assume there is only one password. 

So I think we need to use style="visibility: hidden", but this one will make the label of the field still visible so you can make string = " " [space].

So your code will looks like:

<field name="fake_password" password="True" string = " " style="visibility: hidden"/>
<field name="password" password="True"/>


Still there may be another solution rather than this workaround ..


Hope this could helps ...

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 10/27/16, 12:58 AM
Seen: 758 times
Last updated: 10/27/16, 3:12 AM