When you show a one2many or a many2many field on a form, you don't have much control over how it is rendered up to now if you haven't used one of the specialized widgets. Also, in the case of many2one fields, it is desirable sometimes to be able to influence the way the linked record is opened. In this recipe, we'll look into how to define private views for those fields.
<field name="child_ids">
<tree> <field name="name" /> <field name="email" /> <field name="phone" /> </tree> <form> <group> <field name="name" /> <field name="function" /> </group> </form>
</field>
When Odoo loads a form, it first checks for reference fields if there are views embedded as outlined previously. Those embedded views can have the exact same elements as views we defined before. Only if Odoo doesn't find an embedded view of some type, does it use the model's default view of this type.
While embedded views seem like a great feature in the first place, they complicate view inheritance a lot. For example, as soon as embedded views are involved, the field names are not guaranteed to be unique and you'll usually have to use some quite elaborate XPaths to select elements within an embedded view.
So, in general, you should better served defining the standalone views and use the keys form_view_ref
and tree_view_ref
described earlier.