Pre-alpha. No tagged release and no upgrade path between versions. Use for evaluation and development only, not production.
Core DevPre-alpha

How to extend a view with xpath inherit

Goal: change another module's stored sys.view.arch by merging an xpath fragment (see inherit_id on sys.view records in module XML).

When to use

  • You need an extra field or layout tweak on a base (or third-party) form without forking the whole XML arch.

Steps

  1. Add a with model="sys.view" in your module's XML (after the parent view exists — list this file after the module that defines the parent view in depends, or run -u twice if ordering is tricky).
  2. Set inherit_id (parent view XML id) and arch (xpath fragment).
  3. Add the file to manifest.json → data (after base views, in *_inherit_views.xml).
  4. Run -u your_module.

Live example (contacts)

The kernel contacts addon adds customer_rank to core.partner. Add the field with inherit= first — see Model inherit — then expose it in the form:

views/core_partner_form_inherit_views.xml
xml
<record id="view_core_partner_form_contacts_inherit" model="sys.view">    <field name="inherit_id" ref="contacts.view_core_partner_form"/>    <field name="arch" type="xml">        <xpath expr="//field[@name='phone']" position="after">            <field name="customer_rank" string="Customer Rank"/>        </xpath>    </field></record>

Source: sumeru/addons/contacts/views/core_partner_form_inherit_views.xml

Caveats

  • The merge runs on the serialized arch; xpath expressions must match that structure.
  • Errors print as view-inherit warnings during sync; fix xpath and re-run -u.

See also