Odoo Help

Welcome!

This community 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.

0

Disable autofill on password field

By
Roy Nurmi
on 10/27/16, 12:58 AM 182 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

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


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 ...

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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