Reputation: 431
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>
Upvotes: 1
Views: 1168
Reputation: 529
Veikko`s answer is universal for all versions of Odoo but requires to rewrite full dom structure in new place
For Odoo starting version 12.0 best for move field and other is (described here):
<xpath expr="//field[@name='category_id']" position="after">
<xpath expr="//field[@name='mobile']" position="move"/>
</xpath>
Upvotes: 0
Reputation: 3610
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>
Upvotes: 1