OdooWiki OCA HUB

Extended view inheritance

base_view_inheritance_extension folder_open OCA/server-tools open_in_new
Hidden/Dependency License: LGPL-3

This module was written to make it simple to add custom operators for view inheritance.

auto_awesome What this module does

AI-generated from the code · Odoo 20.0

Adds new operators to Odoo view inheritance so developers can wrap text in elements and update, extend or merge attribute values (contexts, domains, text) when customizing existing screens.

This is a technical helper module for developers who customize existing Odoo screens by extending views. It does not add menus or business features for end users; instead it enriches how view inheritance works on ir.ui.view.

What it enables: - A new wraptext position that takes the plain text (or trailing text) of an element and wraps it in a new element, e.g. a span. It refuses to run if the target expression finds nothing or if the position is not text or tail. - New attribute operations: update merges a dictionary into an existing dictionary attribute such as a context, keeping existing keys and adding or replacing others; text_add inserts the old value into a text template; domain_add combines an existing domain with a new one using AND or OR, optionally guarded by a condition.

Business rules and checks: - If a target element cannot be located, a clear view error is raised naming the failing specification. - Invalid wraptext usage (children present, nothing found, wrong position) raises a validation error. - When editing translations, wrapped text is kept consistent with translation markers.

A demo view extends the simple partner form to show these operators in action. The module touches only the view model ir.ui.view and the partner form used for demonstration.

Text generated by AI (DeepSeek) from reading the Odoo 20.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 9 confirmed, 0 with no information of 9 versions.

Sources · Odoo 17.0

Confirmed on 2026-11-03 in branch 17.0 of OCA/server-tools.

terminal Installation and usage

OCA documentation · Odoo 20.0

Change a python dictionary (context for example)

<field position="attributes">
    <attribute name="context" operation="update">
        {
            "key": "value",
        }
    </attribute>
</field>

Note that views are subject to evaluation of xmlids anyways, so if you need to refer to some xmlid, say %(xmlid)s.

Add text after and/or before than original

<attribute name="$attribute" operation="text_add">
    $text_before {old_value} $text_after
</attribute>

Add domain with AND/OR join operator (AND if missed) allowing conditional changes

<attribute name="$attribute" operation="domain_add"
           condition="$field_condition" join_operator="OR">
    $domain_to_add
</attribute>

Wrap loose text in an element for further processing

<wraptext expr="//some/node" position="text" element="span" />
<wraptext expr="//some/node/other_node" position="tail" element="div" />

which transforms

<some>
    <node>
        plain text 1
        <other_node />
        plain text2
    </node>
</some>

to

<some>
    <node>
        <span>plain text 1</span>
        <other_node />
        <div>plain text2</div>
    </node>
</some>

making those texts accessible for further operations

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.