Search code examples
odooodoo-8odoo-10odoo-view

Change the Position of field - Odoo


I am using Odoo 10 and I am trying to move the position of the mobile field. The below code works but the new mobile field does not have any data. Mobile number is missing. I remove that code and the mobile number comes back.

<xpath expr="//field[@name='mobile']" position="attributes">
               <attribute name="invisible">1</attribute>
            </xpath>
            <xpath expr="//field[@name='category_id']" position="after">
                <field name="mobile" />
            </xpath> 

Solution

  • You cannot have same field twice in the view. You need to completely remove the field first and add it to another place after that. Your templates work if you change the first xpath to remove the field, not just hide it. This can be done like this

    <xpath expr="//field[@name='mobile']" position="replace">
                </xpath>
                <xpath expr="//field[@name='category_id']" position="after">
                    <field name="mobile" />
                </xpath>