Odoo Help


How to remove focus from readonly fields ?

Jignesh Mehta
on 6/21/16, 1:38 AM 3,062 views


I have one wizard in which 9 fields are there. Out of 9 fields, 4 fields are read only.

When wizard is open, i used TAB key for fill the value in fields.

When i used TAB key, focus also gone to read only fields. But i want to remove it. When i fill last fields, the focus directly gone to button using TAB.

Also I want to focus on specified fields on TAB.

Wizard Code :-

<div class="col-md-4">


        <field name="lot_id" options="{'no_create': True}" required="1" attrs="{'readonly' : [('have_product', '=', True)], 'required' : [('have_product', '=', False)]}"/>

        <field name="type_product_id" readonly="1" tabindex="-1"/>

        <field name="shape_product_id" readonly="1" tabindex="-1"/>

        <field name="color_product_id" readonly="1" tabindex="-1"/>

        <field name="size_product_id" readonly="1" tabindex="-1"/>

        <field name="clarity_product_id" readonly="1" tabindex="-1"/>

        <field name="have_product" invisible="1"/>



Thanks in advance.


--Ahmed M.Elmubarak--

Ahmed M.Elmubarak
On 6/21/16, 4:42 AM


The readonly fields is not tabindexed by default [Which version you're using ?], moreover you can set the attribute tabindex="-1" remove the tab index focus and you can use the same attribute with different numbers  to order your fields by tab indexing ...

Hope this could help ...

Hello Ahmed, I am using version 9.0 of odoo. I used tabindex="-1" in readonly field but still facing same issue.

Jignesh Mehta
on 6/22/16, 12:22 AM

Jagdish Panchal

--Jagdish Panchal--

| 5 4 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 6/22/16, 3:04 AM


I have tested below code for version 8.0 and 9.0 its skip tab focus.

 <field name="phone" readonly='1' tabindex="-1"/>

<field name="mobile" tabindex="-1"/>

<field name="fax" readonly='1' tabindex="-1"/>

Thanks sir. But i am facing same issue using tabindex="-1". See my updated question in which i have added code for wizard.

Jignesh Mehta
on 6/22/16, 3:17 AM

Hello Jigesh,

I tested tabinex=-1 with many2one field its not work with read only field with many2one

Jagdish Panchal
on 6/24/16, 3:11 AM

Thank you so much sir. But I want it with readonly many2one field. Is there any other idea ?

Jignesh Mehta
on 6/25/16, 12:24 AM

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.


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

2 follower(s)


Asked: 6/21/16, 1:38 AM
Seen: 3062 times
Last updated: 1/6/17, 9:25 AM