I'm doing the odoo getting started tutorial. And I need to create a xpath expression. I need to inherit the base.view_users_form view and add page to display a list of properties. This page should go after the preferences page, so I created this expresssion.
<record id="inherited_res_user_view_form" model="ir.ui.view">
<field name="name">res.users.extended.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='preferences']" position="after">
<field name="property_ids"/>
</xpath>
</field>
</record>
and the error:
Element '<xpath expr="//page[@name='preferences']">' cannot be located in parent view
So I know my expression is incorrect, but I dont know what it should be.
I also don't know how I can find out. I read a bit about how it works, and I think I understand sufficiently. But I think I need to see the source code of base.view_users_form to find how they name their elements so that I can properly use xpath. But I can't find the source code also.
If you look carefully in the view_users_form code, you will see that the page is named references
and not preferences
.
Try the following XPath:
<xpath expr="//page[@name='references']" position="after">
<page string="Properties" name="property_ids">
<field name="property_ids"/>
</page>
</xpath>