Skip to content
ERPForAll DocsDevelopment

    View Architectures and Inheritance

    Status: view parsing, XPath inheritance, validation, and database records are complete (erp-views, crates/erp-data, addons/base). Implements: ADR 0005 (layer L7), ADR 0009 §12, ADR 0018, ADR 0019, ADR 0020. Specs: docs/specs/data/data-views-api.md (SPEC-DATA-042, 043, 044..059, SPEC-DATA-061).

    The erp-views crate provides the pure architecture parsing, locator, inheritance, and combination engine for ERPForAll. It operates completely in memory without database dependencies, converting XML view architectures into a structured DOM tree and applying inheritance patches with exact Odoo semantics.


    In ERPForAll, view architectures are represented by the ArchNode DOM tree, while views in the system are registered as ViewDescriptor values.

    use erp_views::{ArchNode, CombinedView, ViewDescriptor, ViewMode, combine_view, parse_xml};
    let base_arch = r#"
    <form string="Partner">
    <sheet>
    <field name="name"/>
    <field name="phone"/>
    </sheet>
    </form>
    "#;
    let base_view = ViewDescriptor::new(1, "base.partner.form", "res.partner", base_arch);

    ArchNode implements the standard element tree model with text and tail semantics:

    • tag: The XML tag name (e.g., form, field, xpath).
    • attributes: An ordered mapping (IndexMap<String, String>) preserving attribute declaration order.
    • text: Text content immediately preceding the first child element.
    • tail: Text content immediately following this element, before the next sibling.
    • children: Ordered vector of child ArchNode elements.
    use erp_views::parse_xml;
    let node = parse_xml(r#"<div class="row">Hello <b>World</b>!</div>"#)?;
    assert_eq!(node.tag(), "div");
    assert_eq!(node.attr("class"), Some("row"));
    assert_eq!(node.text(), Some("Hello "));
    assert_eq!(node.children()[0].tag(), "b");
    assert_eq!(node.children()[0].text(), Some("World"));
    assert_eq!(node.children()[0].tail(), Some("!"));
    # Ok::<(), erp_views::ViewError>(())

    Views can be either Primary or Extension:

    • ViewMode::Primary: Defines a base view or a standalone derived view.
    • ViewMode::Extension: Extends a parent view (specified by inherit_id).
    use erp_views::{ViewDescriptor, ViewMode};
    let ext_view = ViewDescriptor::new(
    2,
    "addon.partner.form.inherit",
    "res.partner",
    r#"<xpath expr="//field[@name='phone']" position="after"><field name="email"/></xpath>"#,
    )
    .with_inherit_id(1)
    .with_priority(16);
    assert_eq!(ext_view.mode, ViewMode::Extension);
    assert_eq!(ext_view.inherit_id, Some(1));

    Extension views locate an element in the parent view and apply modifications according to the position attribute.

    Appends the specification’s children to the inside of the target element:

    <sheet position="inside">
    <field name="website"/>
    </sheet>

    Inserts elements as siblings immediately after or before the target element. Any trailing tail text on the target element is properly preserved and transferred to the end of the newly inserted siblings:

    <field name="phone" position="after">
    <field name="mobile"/>
    </field>

    Replaces the target node:

    1. Outer replace (mode="outer", default): Replaces the target element with the children of the specification.

      • If the specification has no children, the target node is removed.
      • $0 wrapping: If any inserted element has text $0, it is replaced with a deep clone of the original target element.
      • Root replacement: Replaces the entire root architecture (preserving t-name if present).
    2. Inner replace (mode="inner"): Clears all text and children of the target element and inserts the specification’s children, preserving the target’s tag and attributes:

    <div class="header" position="replace" mode="inner">
    <h1>New Title</h1>
    </div>

    Modifies attributes on the target element without altering its children or text. Each child must be an <attribute> tag:

    <field name="name" position="attributes">
    <attribute name="required">1</attribute>
    <attribute name="placeholder">e.g. John Doe</attribute>
    </field>

    List-Valued Attributes (add, remove, separator)

    Section titled “List-Valued Attributes (add, remove, separator)”

    For attributes containing lists (e.g. class):

    <xpath expr="//sheet" position="attributes">
    <attribute name="class" add="o_custom_sheet" remove="o_old_sheet" separator=" "/>
    </xpath>

    Python Expressions (invisible, readonly, required, column_invisible, t-if, t-elif, decoration-*)

    Section titled “Python Expressions (invisible, readonly, required, column_invisible, t-if, t-elif, decoration-*)”

    Expression attributes combine with boolean logic using separator="and" (default) or separator="or":

    <field name="phone" position="attributes">
    <attribute name="invisible" add="is_company == True" separator="or"/>
    </field>

    This wraps expressions with parentheses to preserve operator precedence: (existing) or (is_company == True).

    Nodes can be moved from anywhere in the architecture to the target location:

    <sheet position="inside">
    <xpath expr="//field[@name='old_location']" position="move"/>
    </sheet>

    ERPForAll enforces:

    • The moved node must exist in the architecture.
    • Moving the root element is forbidden (ViewError::MoveRootElement).
    • Moving the target node itself or an ancestor of the target is rejected (ViewError::MoveTargetOrAncestor).

    ERPForAll supports a well-defined subset of XPath 1.0:

    • Location steps: Root /, absolute /form/sheet, descendant //field, child sheet/field.
    • Per-parent indexing: [n] uses 1-based indexing relative to direct sibling elements of the same tag.
    • Attribute matching: [@name='phone'], [@attr].
    • Text matching: [text() = 'Overview'].
    • Class matching: hasclass('c1', 'c2') matches elements having all specified CSS classes in their whitespace-separated class attribute.
    • Negation: not(predicate).
    • Boolean combinations: predicate and predicate, predicate or predicate.

    Unrecognized or invalid XPath syntax fails loudly with ViewError::InvalidXpathExpr.

    Extension views can also match elements without full XPath:

    • <field name="target_name" position="..."/>: Matches the first <field> element with attribute name="target_name".
    • <tag attr="val" position="..."/>: Matches the first <tag> element having exact matching attributes.

    To ensure view stability across locales, using translated attributes as selectors is strictly forbidden:

    <!-- REJECTED: Translated attribute selector -->
    <button string="Save" position="after">...</button>
    <xpath expr="//button[@string='Save']" position="after">...</xpath>

    The system rejects string, help, placeholder, confirm, title, etc., and their t-attf-* variants, returning ViewError::TranslatedAttributeSelector.


    Use combine_view or combine_views_batch to resolve view inheritance hierarchies:

    use erp_views::{ViewDescriptor, combine_view};
    let catalogue = vec![
    ViewDescriptor::new(1, "base", "res.partner", "<form><field name=\"name\"/></form>"),
    ViewDescriptor::new(2, "ext1", "res.partner", "<field name=\"name\" position=\"after\"><field name=\"phone\"/></field>")
    .with_inherit_id(1)
    .with_priority(10),
    ViewDescriptor::new(3, "ext2", "res.partner", "<field name=\"phone\" position=\"after\"><field name=\"email\"/></field>")
    .with_inherit_id(1)
    .with_priority(20),
    ];
    let combined = combine_view(&catalogue, 1)?;
    assert_eq!(combined.applied_view_ids, vec![1, 2, 3]);
    assert_eq!(
    combined.to_xml(),
    "<form><field name=\"name\"/><field name=\"phone\"/><field name=\"email\"/></form>"
    );
    # Ok::<(), erp_views::ViewError>(())
    1. Hierarchy resolution: Traverses inherit_id to the root primary view.
    2. Filtering: Only active views (active = true) sharing the model with their parent (or explicitly on the inheritance path) are applied.
    3. Priority ordering: Extension views are ordered by (priority, id).
    4. Pre-order application: Extension views apply before primary children at the same level.
    5. Cycle detection: Loops in inherit_id are detected and rejected with ViewError::CycleDetected.

    Per ADR 0019 and ADR 0020, erp-views enforces strict bounds to defend against untrusted or malicious input:

    Every limit is a LimitKind of ViewLimits (full table in ADR 0027 §6); a host can only lower them (ViewLimits::default().lowered(kind, value)), and exceeding one is ViewError::LimitExceeded wrapped in ViewError::InView naming your view.

    • Input size: At most 10 MiB per view architecture (ArchBytes).
    • Nesting depth: At most 256 levels of XML depth (Depth), verified both at initial parse and after each inheritance step.
    • Element and node limits: At most 10,000 elements per arch (ArchElements) and 40,000 XML nodes counting text runs, comments and processing instructions too (ArchNodes).
    • Attributes per element: at most 256 (ElementAttributes), also after position="attributes" edits add some.
    • Combined size: At most 200,000 nodes and 32 MiB built while combining one view (CombinedNodes, CombinedBytes).
    • XPath size: expressions of at most 4,096 bytes, 64 steps and 32 levels of parentheses.
    • Work per combination: at most 20,000,000 evaluation steps (EvaluationSteps): nodes visited while locating and checking depth, comparisons (by their length), predicate tests, and the tokens of attribute edits (cost table in ADR 0027 §6). Real views use a tiny fraction (the 40-extension res.partner benchmark form uses about 12,000); CombinedView::evaluation_steps() shows what a combination used. Paths that start with // and have many steps cost a walk of the whole arch per step, so prefer short, anchored expressions such as //field[@name='email'].
    • DTD rejection: DTDs and external entity declarations are completely disabled.
    • Null character rejection: Raw \0 or entity-encoded &#0; bytes fail immediately.
    • Escaping: Serializer escapes &, <, >, ", \n, \t, \r appropriately to avoid injection and malformed XML.

    6. View records in the database (ir.ui.view)

    Section titled “6. View records in the database (ir.ui.view)”

    Views live in ir_ui_view, declared by the base addon with Odoo’s field names, so the data files of a ported addon load unchanged (docs/design/m2-s3.md §3, §4). Addons ship views as <record model="ir.ui.view"> or <template> in their data files; they extend another addon’s view with inherit_id, never by editing it.

    <!-- addon test_ext_b extends test_ext_a's form without touching test_ext_a -->
    <record id="view_book_form_pages" model="ir.ui.view">
    <field name="model">test_ext.book</field>
    <field name="inherit_id" ref="test_ext_a.view_book_form"/>
    <field name="arch" type="xml">
    <field name="name" position="after"><field name="pages"/></field>
    </field>
    </record>
    • mode: extension when inherit_id is set, primary otherwise; a write of inherit_id without mode makes a view primary when the parent is cleared and extension when a view that had none gets one, and a re-parented view keeps its mode. The rule is applied per record (BUG-074: Odoo decides once for a batch). mode = 'extension' without a parent is refused by the table (“The database refused the change: Invalid inheritance mode: …”).
    • type: the parent’s, else the arch’s root tag (an unknown tag is refused with Odoo’s “Invalid view type” message, which lists the types of the registry, selection_add included).
    • name: "<model> <type>" when missing; key: gen_key.<6 hex> for a QWeb view without one.
    • arch is stored in arch_db. Each data load of arch (install and upgrade) records arch_fs (<module>/<path> of the file it came from) and resets arch_updated to false; a write of arch outside a data load sets arch_updated. A write of arch_db itself changes neither, as in Odoo.

    Every create, and every write of active, arch/arch_db or inherit_id, checks:

    1. recursion of inherit_id (“You cannot create recursive inherited views.”);
    2. the combination of each written view, of its nearest primary ancestor and of every primary view built on that tree through extensions (deactivating an extension that another view needs fails; SPEC-DATA-057);
    3. the arch of each written view: the root tag against the type, the model, <field> elements in document order with the create scope below, and the obsolete attrs/states (SPEC-DATA-058). QWeb views are combined only.

    Creating an extension checks field names in the elements it inserts and their descendants. Moving an old field into a newly inserted group, or inserting a field there through a later sibling extension, brings that field into the check. An unrelated stale field outside those subtrees does not block the create. The root/model checks, missing field names, group checks and obsolete attributes still run independently of this field-name scope.

    Creating a root view, or applying a replace or attributes spec, checks field names across the whole combined arch. XML character references are decoded before choosing that scope: position="&#114;eplace" widens it just like position="replace". Ordinary writes also check the whole arch. Deferred x2many subviews remain excluded and produce the warning described below.

    An archived view is never combined (an inactive view on the path is an error of the engine), but writing one still checks it on its own: its arch must parse, and an archived root view’s arch is validated as above. A malformed arch is never stored, active or not.

    Concurrent writes to one inheritance tree are serialized: each check locks the roots of the trees it reads (and a write of inherit_id the roots of the trees its views leave), so two transactions cannot both commit a cycle or a combination the other did not see; the second one fails with a serialization error and can be retried.

    A failure is a Validation error that names the view whose arch holds the faulty spec or node, its external id, its data file and the line in its arch:

    Error while validating view bad (test_ext_c.view_book_form_bad) in test_ext_c/data/views.xml, arch line 3:
    Field "no_such_field" does not exist in model "test_ext.book"

    The line counts in the view’s arch as stored (the loader’s arch starts with the <?xml version="1.0"?> line), not in the data file. The error’s context holds name (the written view, BUG-071), xmlid, view.model, file and line; its source is the typed erp_sdk::views::record::ViewRecordError, whose Invalid variant carries an InvalidView (Combine(ViewError) or Arch(ArchIssue)).

    Not checked yet, and reported instead of skipped without a word: x2many sub-views inside a <field> (ArchWarning::SubViewNotValidated, until the web server delivers them), and groups that name no group (ArchWarning::UnknownGroup; such a reference never matches). The overrides post them to the transaction’s notice channel (tx.notices(), tx.take_notices()) and log them on target erp::views with the view’s name, external id and file: each unknown group on its own line, all sub-views of one check on one line. erp_addon_base::ir_ui_view::check_views returns them as values. The expression attributes of the elements it does read are checked (next section); the rest of the per-tag validation (buttons, labels, widget options) comes with the web server (planned).

    Expression attributes and restricted fields (SPEC-DATA-104). Write-time validation and get_view read the fields these attributes name:

    AttributeOnRead asNames resolve on
    invisible, readonly, required, column_invisible, decoration-*any elementPython expressionthe node’s model
    contextany elementPython dict expression; its group_by (a string, or a list of strings, :interval stripped) is read as field namesthe node’s model
    domain<field>domainleft side (field path): the field’s comodel; right side: the node’s model
    domain<filter>domainthe view’s model, both sides
    filter_domainsearch <field>domain (self is the typed value)the view’s model, both sides
    date, end_date<filter>a field namethe view’s model
    default_order<list>, <pivot>field [asc|desc], ... (a pivot has one measure; __count is the row count)the view’s model

    t-if, t-elif, t-att-* and the widget options are not read. The list above is what this release reads, not everything Odoo’s client reads: the kanban default_order, the default_group_by of list and kanban views and the pivot_measures, pivot_row_groupby and pivot_column_groupby keys of a <filter> context are not read yet (they come with the web server, planned). The operator of a domain leaf must be a string literal, and the right side of any, not any, any! and not any! must be a literal list of leaves; it is read as a domain on the comodel of the left path. A group_by of another type than string or list of strings, and a context key that is not a string literal, are refused. Only the root of an attribute chain is a field (partner_id.name reads partner_id), a short list of names the client provides (uid, context, today, bool, self, …) is not a field (but a field of the model with one of those names is refused: the client would let the field override the name; so is parent.parent on a model with a field parent), and inside a relational field’s sub-view parent.x reads the enclosing model while a bare name reads the sub-view’s model. parent.x outside a sub-view is refused (Odoo drops it silently), and so is a bare parent (parent['x'], len(parent)). A name that is not a field is ArchIssue::UnknownFieldInExpression; an expression that does not parse, a value that is not a domain, a domain on a field that is not relational or a name the guard plan cannot hold is ArchIssue::InvalidExpression. The attribute is read only inside the validation scope of the write (the same rule as for unknown <field> names), and the content of a sub-view is not read at write time for now: get_view still reads it when it captures the bundle.

    A visible node may not read a field it does not guard. If a field’s definition has groups, every node that reads it in one of these attributes must be shown only to users who may read the field: the node’s effective guard (its own groups intersected with its enclosing nodes’ and, for a <field> element, the field’s own definition) must imply the field’s groups. Otherwise the write is refused with ArchIssue::RestrictedFieldInExpression naming the attribute, field, model and groups. The rule is sound and not complete: repeat the field’s groups on the node (or an enclosing node) and it passes. A group implies another through the group implication relation (implied_ids), a . guard implies everything, an unguarded node implies nothing, and a negated group (!x) in the field’s groups must be excluded by the node (by !x or by the negation of a group that x implies). It is a divergence from Odoo (Parity: divergent — ADR 0060 D3.5). At serve time the same read is checked against the user’s field masks: if the node survives the filter and a field it reads is unreadable for the user, get_view fails with Access naming view, line, attribute, model and field instead of dropping only the expression; a node that is removed by its own guard (or an enclosing one) raises nothing.

    Each notice carries a NoticeKind (UnknownGroup, SubViewNotValidated, Other; the enum is #[non_exhaustive], so match with a wildcard arm), a target and a message; do not match on the message text.

    Notice lifetime and bounds (SPEC-DATA-082). Notices belong to one transaction attempt. Commit, rollback and reset() clear them; a rollback to a savepoint drops the notices posted inside it and a release keeps them. With Orm::run, call tx.take_notices() inside the closure, before the commit: after the closure returns they are gone, and a retried attempt starts empty. A transaction keeps at most MAX_NOTICES_PER_TRANSACTION (256) notices and a message at most MAX_NOTICE_MESSAGE_BYTES (4096) bytes; a longer message is shortened and ends with ... [truncated: N bytes total]. A notice past the count cap is not stored: it is counted in tx.notices_overflowed() (a rollback to a savepoint does not decrease it; take_notices, clear_notices, commit and rollback reset it) and the first one of an attempt logs a warning on target erp::notices.

    An extension view may not have group_ids (“Inherited view cannot have ‘groups’ defined on the record. …”); put groups attributes inside the arch instead (SPEC-DATA-059).

    During an install or upgrade, the primary views whose data has not loaded yet are not combined (they still hold their old archs): views of modules of the operation that come later, and views of the module loading now that it has not reached yet. A view written earlier in the same file counts as loaded, as in Odoo. After each upgraded module, its noupdate views are checked (ir.ui.view._validate_module_views, called by the module system; not after a reinit, which writes noupdate records too).

    The loader passes what is loaded in the context of every write that carries install_module, also when your model’s create writes views (layout in erp_data::load::load_state). Code that sets install_module itself, outside the loader, gets a Programming error from a view write: the check would otherwise take “no load state” for “nothing loaded”.

    For H18 module-data admission, XML and CSV operations additionally carry the loader-owned erp_sdk::load_state::DECLARING_MODULE key (__erp_data_module). It is stamped after authored context and reaches idless records and nested relational commands. A view or window mode outside list, form, search (and the separate qweb template kind) must belong to a dependency of that module and be published in the exact registry generation. These checks require an operation-managed System transaction with full elevation: setting context in ordinary CRUD does not establish lifecycle authority. The key grants no ACL or field-access permissions.

    use erp_addon_base::ir_ui_view::select::{ViewRequest, ViewType, default_view, select_view};
    let form = ViewType::new(&tx, "form")?;
    // the active primary view with the lowest (priority, name, id): one statement
    let default = default_view(&mut tx, "res.partner", &form).await?;
    // the context's `form_view_ref`, else the default
    let picked = select_view(&mut tx, &ViewRequest::new("res.partner", &form)).await?;
    for notice in picked.notices() {
    // RefNotQualified, RefNotFound, RefOtherModel, RefOtherType (BUG-073)
    println!("{notice}");
    }

    A <type>_view_ref that is not a qualified external id, names no view, or names a view of another model or type is ignored, the default view is used, and the reason comes back as a ViewNotice (Odoo uses a view of another model; BUG-073). A ref longer than 256 bytes or not text is an error. A view given with ViewRequest::view_id is checked in one statement: a view that does not exist is Missing, one of another model or type is a Validation error. A type a request names that the registry does not have is “Unknown view type ‘<type>’. Allowed types are: …”. No view at all is a UserError (“No default view of type ‘kanban’ could be found! …”); generated default views come with the web server (planned).

    Per-user get_view and Group Filtering (SPEC-DATA-060)

    Section titled “Per-user get_view and Group Filtering (SPEC-DATA-060)”

    The web client fetches view architectures via get_view:

    use erp_addon_base::ir_ui_view::get_view;
    use erp_addon_base::ir_ui_view::select::{ViewRequest, ViewType};
    let form = ViewType::new(&tx, "form")?;
    let req = ViewRequest::new("res.partner", &form);
    let resp = get_view(&mut tx, &env, &req).await?;
    println!("Filtered arch: {}", resp.arch());

    get_view runs three steps: bundle, mint, filter (ADR 0060 D3).

    1. Bundle (shared, templates ormcache). The inheritance tree is read read-only (fetch_trees_read_only, no row locks, works in read transactions) and combined. GuardedArch::capture(combined, model, &record_guards, &lookup, &ViewLimits::default()) then strips every groups attribute from the arch and records the guards it carried: the element’s own groups intersected with the enclosing guard, and for a <field> also the groups of the field definition. Equal effective guards share one index (numbered by first occurrence in document order). record_guards are (view id, group ids) of the applied primary views that have group_ids. The resulting bundle and its GuardPlan (host_access::plan_of(&guarded)) are cached across users and transactions. A groups value with no group reference at all or with a malformed non-empty term (empty terms beside a real reference are ignored; install-time validation refuses the same values), an unknown <field>, an expression attribute that cannot be read or names a field its model does not have, or more than 64 references in one effective guard fail the capture with a ViewError::GuardCapture naming the view and line (Validation through get_view); too many distinct guards is ViewError::LimitExceeded. Nothing is served partly captured.
    2. Mint (per call). get_view checks the caller can read the model, then calls tx.evaluate_guards(&env, &compiled.plan).await?. The transaction decides every guard of the plan for env’s user once, from one snapshot of the user’s groups, and returns a GuardEvaluation that borrows the transaction. Unknown group references never match (a negated unknown one never excludes), and a user in no group is refused by every guard. A model other than the view’s own that the user may not read (the comodel of an x2many) is not an error: its fields count as unreadable, so the fields inside its sub-view are left out of the served arch; the relational field itself stays with an empty sub-view. The same holds for the expressions: inside such a sub-view a node whose decoration-*, invisible and the like read an unreadable field is removed, and a relational field whose own domain reads the comodel is removed, instead of failing the view (a relational field that holds a sub-view or a domain adds the probe <field>.id to the plan for this). Only the view’s own model refuses (Access).
    3. Filter (per call). host_access::filter(&env, &compiled.guarded, &evaluation)?.to_xml() first checks that the evaluation was minted for this principal, that the bundle and the evaluation share a registry generation, that the evaluation’s plan equals the bundle’s own guard table, and that every record guard is satisfied. Then it writes the arch in one streaming pass. A subtree whose guard is false is omitted and keeps its parent’s tail text (<span>(<field name="x" groups="deny"/>)</span> -> <span>()</span>); an attribute-less <t> that had its own guard and passed is unwrapped so that enclosing layouts (<group>, <list>) keep their structure. A mismatch is an Access error (another principal, another plan, an unsatisfied record guard) or Validation (another registry generation): the filter fails closed, it never returns an unfiltered arch.

    A warm call costs one database statement for view selection and none for the tree fetch, plus the guard evaluation (its resolved plan is cached per policy snapshot).

    An addon never filters an arch itself. GuardEvaluation and FilteredArch have private fields and no public constructor, so an addon cannot supply its own verdicts or build a filtered arch from booleans, and the filtered arch always matches the plan the evaluation decided. (Whether the plan is right depends on the host’s GuardLookup answers and record guards; only base supplies them today.) the compile-fail cases of crates/erp-views/tests/compile_fail.rs pin this (forged literal, new, outliving the transaction, committing while a verdict is held). The only way to serve a filtered arch is get_view, or host_access::filter with an evaluation the transaction minted. Call get_view; if you hold a ViewResponse, do not re-process its arch.

    GuardLookup contract. capture asks the host for four answers about the registry, read once per capture:

    pub trait GuardLookup {
    fn registry_generation(&self) -> u64; // the registry state the answers belong to
    fn field_groups(&self, model: &str, field: &str) -> Option<&str>; // group spec text of the field definition
    fn comodel(&self, model: &str, field: &str) -> Option<&str>; // comodel of a relational field, else None
    fn has_field(&self, model: &str, field: &str) -> bool;
    }

    addons/base implements it over the transaction’s registry (RegistryGuardLookup). A <field> below a relational field’s sub-view resolves against that field’s comodel. A bundle captured under one registry_generation is refused under another.

    A view limited to groups. get_view refuses (Access) a primary view whose group_ids are non-empty and do not include the user; a view with no group_ids is never refused (SPEC-DATA-101, Parity: divergent — ADR 0060 D3, accepted by the lead: Odoo’s _check_view_access is called only when rendering templates and by the website addon, never by get_view). Choosing the view without an id does not skip such a view: the lowest-priority primary is selected whatever its groups and then refused, it never falls through to the next primary; ask for a view by id (or a *_view_ref) to get another one.

    Breaking change for addon code. FilterDecision is no longer exported from erp_sdk::views and Arch::to_xml_filtered is now crate-private to erp-views (it was the callback filter get_view used); Transaction::group_spec_matches and the matching helper in erp-orm were removed. The only users found under addons/ were in base (get_view.rs), which now uses the flow above. erp_sdk::views exports GuardLookup, GuardedArch and host_access::{FilteredArch, filter, plan_of}. Design: docs/design/m2-s3-b-guarded-arch.md.

    Breaking change for RegistryLookup implementors (GA-3). erp_sdk::views::validate::RegistryLookup gained three required methods, field_groups(model, field), comodel(model, field) and implies(group, implied), because write-time validation now reads expression attributes (see above). ArchIssue gained InvalidExpression, UnknownFieldInExpression and RestrictedFieldInExpression (the enum is #[non_exhaustive]), and erp_sdk::views::validate::reads_fields(&Arch) tells whether an arch holds expressions that need the group implication data. addons/base implements the trait over the registry and the res.groups implication relation.

    Every create, write and unlink of a view invalidates the named cache templates; with signals on, the commit bumps cache:templates and every other node clears it before its next transaction (MN-1). A migration that writes ir_ui_view with SQL bypasses that: it must call tx.invalidate_ormcache("templates") itself.

    Uninstalling a module removes its own views with its other records, and with them every view built on them, the extensions of modules that stay included (as Odoo does). Then the views users copied from them: views keyed <module>.… that no module staying installed names by external id (an __export__ id is no module’s), archived ones and the views built on them included. PurgeReport::copied_views_removed counts every view that went that way, copied_views_kept the keyed views a staying module names.

    The other records a module owns in base models go too: a group with its memberships (its users stay). A record of a staying module that still points at one of them through a restrict foreign key fails the uninstall with the ORM’s error. A row left after the purge that holds a selection value the module added (a view of a type it added, …) fails the uninstall until selection ondelete handling exists; the rows the purge deletes itself never count.

    Arch size 10 MiB at write time even for an inactive view, the engine’s limits at combination, 128 views on one inherit_id path (LimitKind::InheritanceDepth), 10,000 views in one inheritance tree (LimitKind::CatalogueViews), 64 references per groups attribute, 256 bytes per *_view_ref.

    View checks also bound all tree text (names, models and architectures) to 64 MiB before fetching; names and models count twice because the check retains two copies. An oversized value is refused without transferring its text. External-id aliases are limited to 10,000 and 64 MiB of text per lookup; filename diagnostics have a 64 MiB text bound.

    ViewCatalogue::combine_many shares both a work budget (BatchSteps) and a retained-storage budget (BatchBytes, 128 MiB by default). Roots and no-op primary views consume work too. The retained cap covers the parsed cache, returned architectures and their owned container capacities. The active combination and the spec being parsed also have their ordinary per-arch limits. These limits can only be lowered with ViewLimits::lowered.

    For pure validation, use validate::group_refs_with_limits(arch, catalogue.limits()) when a host lowers CheckGroupRefs; repeated mentions of the same group count once. A caller validating several arches also bounds their union before resolving group names. validate::group_refs uses the default limit of 4,096 distinct references; every individual groups attribute still allows at most 64.

    A record form can display any authorized static selection field in its header:

    <form>
    <header>
    <field name="phase" widget="statusbar" statusbar_visible="draft,done" readonly="1"/>
    </header>
    <sheet><field name="name"/></sheet>
    </form>

    Declare the selection and its default using the normal model API. Labels and order come from model metadata; the widget does not require a field named state. Omit statusbar_visible to show all choices. A provided list must contain unique, nonempty known keys; the current record value remains visible even outside the list. readonly="1" displays state only. A writable occurrence uses normal draft edits, onchange and Save/Discard. It never calls an approval method or saves directly. Keep business transition checks on the model. Unknown options, many2one stages and placement outside a record header are refused. Use existing view inheritance to add/modify the header or its field. No approval or activity records are created by declaring this widget. See ADR 0102 for the bounded contract.

    Native declarations use ViewTypeDecl constructors and an owner-bound ViewTypeContribution. A VIEW_TYPES link-time registration alone does not publish a serving contract. The native composition root passes the real addon descriptor and declarations to ModuleSystemBuilder::view_types; erp_addon_web::view_type_contributions() supplies the builtin list/form/search declarations. Composition produces PublishedViewTypes for that exact Arc<Registry>. Policy-bound serving ORMs must explicitly retain this attachment when they rebuild the same generation; a missing attachment or a different registry is an error, with no process-global registration fallback.

    Declarations specify a wire major, renderer, closed schema, validator, builder, metadata fields and exposed data methods. Bare compatibility keys belong to their designated owner; other addon keys use <addon>.<name>. An exposed method contributed by an unrelated addon does not satisfy an owner’s method declaration. Selection additions must reconcile with the published owner. During module data loading, view/action keys require their owner’s installed dependency closure; list/form/search and qweb have the framework record-admission exception described above. Serving still requires publication.

    Callbacks receive a borrowed CheckedViewInput<'_> from erp_addon_base::ir_ui_view::with_checked_view. The base adapter selects and combines the view, evaluates the actual caller’s guards, and invokes the callback while that evaluation is alive. input.root() and CheckedNode traverse admitted nodes; denied descendants cannot be recovered through a raw arch accessor. input.model_spec() is descriptive metadata, not authority to expose a field. input.mobile() is the canonical presentation option. A borrowed with_mobile projection changes no principal, company, group decision, model or lifetime.

    Build directly through DescriptionValueBuilder; root.budget() provides the same request allowance for temporary work and every nested value. Do not serialize/reparse XML or construct an unbudgeted JSON payload before calling the builder. After construction the host independently walks the registered schema, checks every emitted model/field/relation segment through the caller’s ORM, and applies the metadata predicates. Unreadable search fields/filters are pruned as complete items; a surviving prohibited layout or button expression refuses. Unknown paths remain errors. Field metadata reflects both read access and the effective readonly mask, including model/field write denial.

    The builtin adapter retains the existing client wire: list/form/search arenas, explicit nullable modifiers, form regions and object buttons, search expressions, and selection-panel descriptors. An arena must be a bounded tree with valid indexes and layout relationships. The list’s implicit panel comes from the checked search tree directly; its caller context default and notices are added only after authorization. Other view families remain outside this builtin client contract.

    Builtin field, search_field and selection-panel handles name one direct field of the root model: a handle on another model, or a relation path such as company_id.name, is refused with a ValidationError that names the node kind and the handle (relation paths are planned), because the client resolves these handles in the root model’s field catalogue. Relation paths stay valid inside expressions (domains, contexts, modifiers) and in the generic reference slots of non-builtin view types. A search filter or group whose unguarded domain or context reads a field the caller may not read is not pruned: the call is refused with an AccessError that names the view and line; guard the node by group to hide it from callers without the field.

    Server View Description Contract and Admission

    Section titled “Server View Description Contract and Admission”

    Descriptions are uncached and transaction-bound. The base templates cache contains group-agnostic compiled architecture and guard plans; each request evaluates its own authority. PostgreSQL remains the source for views, groups and menus, so process loss discards reconstructible state. Existing multi-node invalidation and request-snapshot rules still apply; this slice adds no shared background quota.

    • Request 1–16 [id|null, type] pairs with wire major 1. Duplicate types refuse; returned views retain request order and real resolved identities.
    • options may be absent. mobile, toolbar and load_filters are booleans with false defaults. Mobile reaches the registered callback; toolbar/load_filters true are refused with an error saying they are not available yet.
    • action_id, embedded_action_id, embedded_parent_res_id and studio are refused in this call. Unknown keys and wrong types are errors. The action-bundle RPC owns its model/view selection.

    Expressions are typed versioned documents. Schema visitors derive references independently of builders: domain tuples, dotted relations, context group-by paths and modifiers all require authorization. Ordinary literal context data is not a domain. Search additionally includes every readable model field of a type the human client can render (others, such as a dynamic selection, are left out of the optional catalogue; a view that references one itself is refused) for custom filters; metadata predicates cannot widen access. Unsupported selection-panel features return an explicit descriptor. Unknown expression operators or fields fail loudly. Search-field operator has the current scalar consumer’s explicit subset: ilike, =, !=, >, <, >=, <=. This slot is checked both during builtin lowering and independently on final custom-builder output. Filter-domain operators have their separate expression contract. Other search-field operator text fails with a located model/field/operator error saying the operator is not available yet.

    Group By items of a list. The list’s search menu offers every <filter> of the model’s default search view whose context evaluates to {'group_by': 'field'} as a Group By item (put them in a <group string="Group By"> as Odoo views do), for example <filter name="group_city" string="City" context="{'group_by': 'city'}"/>. The field must be one the server can group by (stored, readable) and of kind boolean, char, integer, selection or many2one. A field:interval item, a list of several fields, or another field kind is not offered yet; the menu names it under “Not offered here” with the reason. The list is grouped by one item at a time. Only the model’s default search view is read; the action’s own search_view_id is not consulted yet.

    Effective metadata readonly is a floor for every XML occurrence: readonly="0" cannot override model or field Write denial. With writable metadata, repeated occurrences still retain their own static readonly modifiers and combine to an editable record field when an occurrence is writable.

    One DescriptionBudget spans a request’s views, field catalogue, wire copies and serialization. Its 32 MiB construction ceiling accounts logical owned storage; it is not an allocator benchmark. Refusal is sticky. Expressions also share work and encoded-byte allowances. Dynamic source parsing uses erp_expr::source_preflight with the exact parsing limits, reserving before parser/admission allocation and retaining the reservation through both trees’ lifetimes. Admitted-AST encoded length is checked before building another wire copy.

    The encoder limits output to 8 MiB, with a separate 2 MiB field-metadata preview ceiling. The final transport JSON copy and formatter/reservation scratch are admitted too. Requested architectures share a 4096-node cap and the current client tree depth is 32. Menus have a 4096-row cap. Limits can only be lowered by trusted host/test code; no RPC option changes admission.

    A conservative source preflight can refuse a valid large formatted string before parsing. This fail-closed limitation is accepted under ADR 0060 D7; tightening it is planned. The receipt retains the concrete fixture and raw safety output. This is an admission limitation, not a deferred performance assertion.

    The former h18_checked_view_input() placeholder and its missing-bridge refusal are removed. Native H18 serving calls the real checked bridge and the generation’s validator/builder. Pure erp-views consumers do not acquire ORM authority, and guest inputs cannot construct a checked view. Compile-fail fixtures cover direct construction and escaping nodes, evaluations and mobile projections.

    The human-client producer admits object, action, URL and inert buttons in a record form’s header and dialog footer. For type="object", name selects an exposed public model method; string is presentation data. A caption such as “Delete” does not select a built-in command, add an icon, change permissions or supply confirmation.

    <form>
    <header>
    <button name="submit" type="object" string="Submit"
    class="btn-primary" confirm="Submit this record?"
    invisible="phase != 'draft'"/>
    </header>
    <sheet><field name="name"/><field name="phase"/></sheet>
    </form>

    Declare the referenced fields and method in the addon. Keep authorization and business validation on that method: groups and invisible control whether a button is offered, and do not authorize its RPC. Dynamic visibility reads the record’s admitted fields. Existing view inheritance applies before rendering, so extensions add or change declared actions rather than editing another addon.

    A header button confirms only when confirm is declared. After acceptance, the client saves a dirty or new record before calling its object method. Validation refusal stops that call. While execution is pending, affected controls are unavailable; an error is reported instead of repeating the write. An uncertain outcome keeps the existing read-only recovery policy. A danger appearance alone does not ask for confirmation.

    The served ranks are btn-primary (also oe_highlight), btn-secondary, btn-link, btn-success, btn-info, btn-warning and btn-danger. Omitting class selects secondary. A class declaration without a rank selects unstyled; a structural oe_stat_button retains the legacy secondary default. Conflicting ranks fail. rounded-circle selects the circular shape; remaining identifier tokens are addon CSS hooks. Class text has a 512-byte raw limit, at most eight distinct tokens and 64 bytes per token. Tokens match [A-Za-z_][A-Za-z0-9_-]*; only ASCII spaces separate them. Extra spaces canonicalize, preserving token order. Classes do not select an action.

    Header actions keep their declared visible order. On a phone, the first visible action remains direct and additional actions use a separate menu toggle; opening the toggle does not execute that action.

    <header>
    <button name="submit" type="object" string="Submit" class="btn-success addon_submit"
    size="sm" icon="lucide:refresh-cw" title="Submit record" help="Checks the record first."
    confirm="Submit this record?" confirm-title="Review submission"
    confirm-label="Submit" cancel-label="Keep editing"
    data-hotkey="shift+s" debounce="300" block-ui="1"
    context="{'default_name': name}"/>
    <button name="7" type="action" string="Open related action"/>
    <button type="url" href="/documentation" string="Documentation" class="btn-link"/>
    <button string="Unavailable operation"/>
    </header>

    Here submit, name and action ID 7 are examples: declare the method/field and use the real installed action identity. The inert declaration has no type, name or URL and cannot execute. Action targets use a positive JSON-safe numeric identity; they never pass through object-method exposure. Loading/executing the action keeps its own access checks. URL text is at most 4096 UTF-8 bytes: a single-slash absolute application route or an absolute HTTP(S) URL. Network-relative // URLs, backslashes, whitespace/control characters and every other scheme, including javascript: and data:, are refused. The browser repeats admission before navigation.

    AttributeAdmitted declaration
    sizesm, md, lg, mapping to small, normal and large; default normal
    iconlucide:<name>, at most 256 bytes; must exist in the shipped client icon manifest; unknown names fail without fallback
    string, title, helpPlain text, at most 4096 UTF-8 bytes each. An empty/missing caption requires a nonempty title for an accessible name. Help uses a detailed tooltip; debug details describe the control and do not grant server diagnostics.
    confirm, confirm-title, confirm-label, cancel-labelNonempty plain text, at most 4096 bytes each; overrides require confirm
    data-hotkeyOne lowercase letter/digit, optionally prefixed by shift+; Alt is the access modifier. Only eligible controls in the active form/topmost dialog participate; repeated keydown does not activate.
    debounceInteger milliseconds, 0..60000; immediate first activation, repeated activation resets the quiet window, no trailing call
    block-uiStatic boolean (0/1, false/true, False/True); scoped blocking is released on success, refusal or error
    contextExisting bounded expression document, evaluated after save against the saved record and current context; must produce a dictionary

    Caller context is followed by evaluated button context. Protected company/session, identity and locale keys cannot be replaced. Button context also cannot supply active_model, active_id or active_ids. Object calls retain established caller context (including a wizard’s parent context), while method ids use the saved record. Action-ID loading binds active model/record identities from its saved caller. The schema visitor independently derives context field references; an unreadable reference on a button refuses the description rather than publishing its value or pruning an authorization check.

    The wire retains the legacy button, stat_button and cancel_button shapes with optional details. Non-object targets use action_button and a closed action/URL/inert target. Absent details preserve legacy output; present details require size, circle, classes, debounce_ms and block_ui. Optional members are omitted when absent; unknown keys, explicit nulls in these new optional slots and wrong types fail. Custom builders pass the same host semantic checks and DescriptionBudget as builtin XML. These declarations follow ADR 0123’s coordinated strict wire contract.

    A form sheet may declare a button_box containing object-method statistic buttons. The statistic is a real authorized numeric field or a supported relation count; it is never inferred from a label. For example, after defining the count field and the exposed open_orders method:

    <sheet>
    <div name="button_box" class="oe_button_box">
    <button name="open_orders" type="object" class="oe_stat_button" string="Orders">
    <field name="order_count" widget="statinfo" readonly="1"/>
    </button>
    </div>
    <field name="name"/>
    </sheet>

    The client preserves visible button order when space moves actions into More. The same controls and actual statistic values appear in that menu; overflowing an action does not create a second action or a second count request. An invisible button consumes no visible slot. A button box with no visible actions is omitted. The human form layout guide describes the surrounding sheet structure.

    Header/footer action, URL and inert targets do not extend the button-box grammar: statistic buttons remain object methods. List-row buttons, generic kanban/card compilation, multi-create toolbars and Enterprise approval gates retain their own view/backend owners. The full upstream pending-control lock set and independent circle interaction-state obligations retain their separate acceptance scope.

    A dialog cancel control keeps special="cancel", closes without saving or calling a method, and may declare presentation/hotkey/debounce/blocking details. It cannot combine with name/type/href, context, confirmation or confirmation overrides. See the wizard guide. Unsupported declarations fail explicitly.

    <sheet>
    <widget name="web_ribbon" title="Archived" tooltip="Kept for reference" bg_color="bg-warning"/>
    <widget name="notification_alert"/>
    </sheet>

    These display leaves are admitted under record-form form/sheet/group/page/aside containers. They are distinct from Settings/Addons service widgets. They accept groups pruning and refuse expression modifiers and undeclared options.

    For a ribbon, nonempty title takes precedence over text; one is required. Caption and optional tooltip each have a 4096-byte limit. bg_color admits bg- or text-bg- plus info/success/warning/danger. The XML default is success; arbitrary styles fail. This does not change the direct client component’s historical default.

    The notification alert has only its name and optional groups. Permission is read from the browser, refreshed on focus/visibility and supported permission-status changes, and listeners are disposed with the form. Guidance opens only on user action; the widget never requests permission or accepts a server permission value.

    This section describes source behavior. New live view/client checks and the complete parent acceptance evidence remain pending; it does not announce deployment.

    A main-route form has three bands, each with one job. The control row holds New, the breadcrumb, the smart buttons and the pager. The action row heads the sheet column: the <header> buttons on the left, the statusbar ending on the sheet’s right edge. The chatter column starts on the same row, so its button row and the action row share a top (32px controls everywhere). Nothing in the view changes for this: the layout is the client’s.

    Inside the chatter column every block (button row, composer, planned activities, files, the error line, the thread) starts on the column’s left edge and ends on its right edge, with one 8px gap between neighbours on a line and one 12px gap between blocks. The button row is Send message, Log note and Activity as three separate buttons, then the attachments and followers buttons with counts at the right; the composer shows the signed-in user’s avatar (the userName of the chatter options; none without a name), and a message row is a 36px avatar beside the head and body. Addons style these through the erp-mail-* classes; the DOM order (head before body, field name first in a tracking line) is part of the accessible reading order, so reorder visually with CSS, never in the DOM.

    • <button_box> stat buttons render as one joined strip in the control row. Each shows an icon, the value and the label; icon in the button details picks the icon, otherwise a neutral one is shown. When the row is too narrow the strip keeps as many buttons as fit and moves the rest into a “More” menu.
    • Rows of fields sit on a 32px pitch. The label column of a group is as wide as its longest label (up to 11rem), so the values of a group start on one x.
    • A radio widget lays its choices in a row that wraps. Declare options="{'horizontal': false}" to keep a column.
    • The Copy button of CopyClipboard* widgets and the calendar button of a date appear on hover and focus on a mouse device; touch screens always show them.
    • The breadcrumb has two lines: the parent link above, the record name below with a compact record menu beside it. The menu lists Duplicate (the generic copy method of the model), Archive or Unarchive, Delete, a divider and Reload. The model’s own bound actions would follow the divider; the form does not load them yet.
    • A boolean_favorite field declared inside the <title> block shows as a star left of the heading. A picture next to the title is an image widget on a binary field (binary and image fields).
    • The addon’s context line (the control panel’s extension slot) is helper text under the title.
    • A notebook whose tabs do not fit keeps one row: the last tabs move into a “More” menu, the selected tab stays.
    • Tags (many2many chips) are small quiet pills in the form and in the list alike.
    • The aside (Record information) is a collapsed card, with or without a chatter above it.
    • An integer that is not a quantity, such as a year or sequence number, supports options="{'enable_formatting': False}" (or options="{'type': 'number'}"): the value shows without a thousands separator in both read and edit modes.

    A <field> for a one2many without an inline <list>/<form> is shown with the comodel’s own list and form views, as in Odoo (addons/web/static/src/client/x2many.ts, attachSubviews). The list hides the inverse field. The line form opened in a dialog gets the same treatment for its own one2many fields, so an author’s book opened from the Books tab shows its Loans with the loan list’s columns. This goes at most SUBVIEW_DEPTH (3) form levels deep. It stops at a model that is already open higher up, for example a partner’s contacts inside a partner. Such a one2many shows only the lines’ display names. An inline <list> or <form> inside the <field> is refused (“Field nodes cannot contain children.”), and so is editable on a list root: the columns of a sub-list are the comodel’s default list view (the lowest priority), and a line is edited in the comodel’s default form, so give the line model both (addons/account/views/account_move_views.xml, view_move_line_lines). A field cannot name a different sub-list yet. A model without a name field (and no rec_name) shows the model,id display name, as in Odoo. Set rec_name in the model file when its lines need a readable title.

    View action attributes (create, edit, delete)

    Section titled “View action attributes (create, edit, delete)”

    Both <list> and <form> view architectures support action control attributes matching Odoo behavior:

    • create: Set to "0" or "false" to disable creating new records from this view (hides the New button in the list or form view controls).
    • edit: Set to "0" or "false" to disable editing existing records (puts the form in read-only mode).
    • delete: Set to "0" or "false" to disable record deletion (removes the Delete action from the actions dropdown menu).

    Action context keys (e.g. {'create': False}, {'edit': False}, {'delete': False}) are also respected by the Elang client and combine with arch attributes.

    A list column is sized by its field’s kind unless the arch says otherwise: numbers, amounts and dates take their one-line content width within fixed bounds, check boxes at most 100 px, long text at most 600 px, and every other column flexes from 80 px (the record name column from 160 px) and shares the spare room. Set width on a <field> of a <list> to choose the width yourself, in pixels of content (the cell padding comes on top, as in Odoo):

    <list>
    <field name="sequence" widget="handle"/>
    <field name="name" width="[200px]"/> <!-- at least 200 px, flexible above -->
    <field name="code" width="60px"/> <!-- exactly 60 px -->
    <field name="note" width="[100px,400px]"/> <!-- between 100 and 400 px -->
    </list>

    Values run from 1 to 2000 px; px may be left out. Anything else (100%, 12.5px, a maximum below the minimum) refuses the view by name when it loads, and width on a field outside a list view is refused too.

    Field widget presentation contract (in progress)

    Section titled “Field widget presentation contract (in progress)”

    ADR 0124 extends the existing fieldWidgets registry and strict H18 descriptions. The selected base implementation is being verified; consult docs/design/behavior-matrix/field-widgets.md for actual tested scope. Registration alone is not server declaration admission.

    A field occurrence can declare shared placeholder, help and applicable family options. For example, <field name="private_note" widget="password" placeholder="Private note" help="Visible only to permitted readers" autocomplete="new-password"/> requests masked presentation. It does not grant read permission or make a readable value secret on the server. Unknown options and incompatible kinds fail admission. Authorized auxiliary fields are included in record reads; denied dependencies prune their owning field occurrence.

    Trusted adapters retain the object-based createFieldControl contract and disposable handles. They propose value changes to the record owner. Invalid drafts prevent save; adapters never write independently. Multi-field date changes use one changeValues callback so validation cannot observe a half-updated range. Dynamic modifiers use validated expression documents; evaluation errors block the affected operation. The server remains authoritative for access. Dynamic invisible, readonly and required expressions are admitted in record forms only. In a list view (which also supplies x2many columns) they fail admission, for example with Dynamic 'invisible' modifiers on list fields need per-row evaluation, which a later delivery adds.; literal values remain allowed there.

    Values a user can type never break rendering. A url value without an http(s):// or ftp(s):// prefix gets http:// (so localhost:3000 links to http://localhost:3000); a value that still has no safe link, such as javascript:…, is shown as plain text. search_threshold on many2one and many2many_tags is the number of typed characters before a relation search starts (0 to 4096, as admitted by the server); the result count stays the default. password columns of embedded x2many lists are masked like the main list. A tag created with quick-create has no colour until it is read again.

    The existing registry resolves js-class, view-specific and generic adapters in that order for a known identity. Form/list/card component behavior requires separate tests. A card adapter does not establish a served kanban renderer. Code/HTML editor wiring retains its separate ownership.

    Monetary presentation currently targets only amounts that round-trip through the existing JSON numeric contract and currency scale. Lossless Decimal transport remains a completion obligation; unsafe amounts must be refused visibly, never rounded or replaced with zero. An amount whose record has no currency is shown and edited as a plain number without a symbol. While the currency loads, or when the amount cannot be presented, the field shows a status message; that state never blocks saving the record, since nothing was edited.

    Relation domains use comodel criterion paths and root-record RHS expressions. Literal criterion structure is admitted; dynamic domain structure and nested any scopes are explicitly refused for now. Domain/context options never bypass the record RPC’s ACL or field checks. Readonly ranges need both endpoint descriptions/values, but require no mutation capability. Editable ranges require one atomic changeValues callback; line forms forward that callback and the actual numeric locale. Parent line writes reevaluate occurrence policy in the line’s own value scope. Explicit discard invalidates editor-local drafts; unrelated onchange does not discard invalid input. Numeric type='number' selects canonical decimal input; type='text' uses configured separators. enable_formatting (a boolean, True by default) on integer and float fields: False suppresses thousands grouping in both read and edit modes. It is the reference’s option name; the percentage and monetary widgets do not take it, and a view that spells it format is refused by name. Write booleans as True/False, as everywhere in options. hide_trailing_zeros changes readonly formatting only, never the stored amount. Boolean icon_class accepts bounded class tokens. Unsupported family/option combinations fail declaration admission.

    Operations: this wire contract requires the server and generated client assets from the same release. Rebuild/generated-input checks must pass before activating either side. Reload clients after a coordinated update; roll back server and assets together. No database migration is introduced.

    Disposable field handles may expose captureDraft() and restoreDraft() for owner-driven rerenders. The snapshot contains editor text and its validation message, never a save command. An asynchronous adapter retains the snapshot until its inner control mounts; disposal suppresses late rendering. Record-owned discard and successful reload invalidate retained drafts. Failed reload preserves the current editor and its validation state.

    Placeholder fields are authorized text dependencies. A supplied false/null value means an empty placeholder; other non-text values are refused instead of being coerced. Selection, filterable selection and badge-choice overflow use the same dynamic placeholder precedence as text editors. Boolean and display-only badge/label widgets reject placeholder options because they have no placeholder editor surface. This is an invalid declaration, not a silently ignored setting.

    Onchange is independent of the XML button/view grammar above. A native warning may carry validated className and sticky notification options using OnchangeWarning::with_options; see model onchange documentation. ADR 0123 defines the bounded option contract. The client retains accepted field updates if warning presentation fails. These warning options do not change XML button or ribbon admission. A single normalized warning retains its options; distinct warnings combine into an ordered dialog without notification-only options. Deduplication includes class/sticky, and explicit false or an empty class string stays distinct from absence.

    A Text field in a record form can use the code widget:

    <field name="arch_db" widget="code" options="{'mode': 'xml'}"/>

    The closed mode vocabulary is xml, python, javascript, json, qweb, scss, bash, and text. Omitted mode defaults to qweb; an explicit invalid mode fails validation. XML and QWeb are distinct presentation modes. The only admitted option is mode; unknown keys, duplicate keys, expressions and nonstring values fail rather than being evaluated. Options are a literal dictionary limited to 4096 UTF-8 source bytes and parser depth 8, within the shared description budget. See ADR 0125.

    The widget supports Text, not Html or Char. Effective required/readonly field modifiers apply. Draft changes update record dirty state immediately; blur or Save commits pending onchange before persistence. The form retains code-editor handles across identical value echoes so typing, cursor and history remain local. Save/readback, Discard and reload establish authoritative baselines. Code contents are ordinary untrusted text; highlighting does not authorize or execute source.

    An Html field in a record form can use the html widget (or render by default when no widget attribute is specified):

    <field name="description" widget="html"/>

    In form view, the editor is a flat field (no box and no permanent toolbar) with a hint when empty. A formatting toolbar (role="toolbar": bold, italic, underline, strikethrough, undo, redo) floats over a non-collapsed text selection and a / command list (headings, lists, quote, code block) opens at the caret; both are described in Reusable HTML editor. Keyboard shortcuts: Ctrl+B / Meta+B, Ctrl+I, Ctrl+U for formats, Ctrl+Z for undo, Ctrl+Y or Shift+Ctrl+Z for redo. Drafts are staged immediately, and immediate draft staging with onchange commit on blur or save. The form retains editor handles across identical value echoes so typing, cursor position, and undo/redo history remain local.

    In list cells, the field displays safe read-only plain text extracted via an inert template, preventing any script execution.

    When saved, the server is the sole trust authority: server-sanitized content is reflected back into the editor, and server-side refusals or sanitization errors surface directly as typed validation feedback. Required HTML fields prevent saving when empty or containing only empty scaffolding. Readonly HTML fields display formatted content with controls disabled and editing prevented.

    Trusted custom draft widgets may use WidgetEnvironment.draft and return the optional WidgetHandle.draft lifecycle: admit a replacement without mutation, flush accepted input, update an authoritative value/policy, validate the full document, focus, and disable the whole editing engine. RecordForm supplies staging/commit ownership, preserves stable occurrences and disposes them when removed. Ordinary widgets retain their existing change contract. RecordState admits one editor owner through bindEditorOwner; its disposer detaches only that owner and invalidates pending onchange reads. Incoming load, onchange and save values pass draft admission before replacing an accepted source. This ensures direct Save paths also await pending drafts. A standalone control must not invent persistence or bypass the record owner.

    The Technical Views form declares arch_db with explicit XML mode. Existing databases require the normal base addon data upgrade to receive that declaration. Invalid-locator overlays, general Html wiring and additional upstream adapter options remain outside this delivery; SPEC-WIDGET-030 is partial.

    SchemaNode::ScopedDomain and DescriptionValueBuilder::scoped_domain carry a validated expression document with a descriptive target model. They grant no ORM or caller authority. The independent constructed-value and serialized visitors keep criterion fields in that model, and category variable names in the root scope, including otherwise special names such as uid. validate_panel_domain enforces the narrower panel grammar; general expression admission alone does not authorize a panel predicate. The native host independently checks that the target model matches the section relation and that RHS dependencies name declared categories.

    Builtin list/search declarations publish web.list_sections_v1 / web.search_sections_v1. The schema grammar revision remains 1. Closed sections payloads require these capability keys; the adapter and updated client still admit legacy shapes under old keys. Structural callbacks cannot populate default_values: the reserved adapter initializes empty arrays and the host’s caller overlay is their only producer. Broader panel controls remain unavailable for now; metadata acceptance is not interactive parity.

    For H18 panel producers, with_checked_panel_view admits raw syntax before access filtering and removes complete denied sections and their dependents before the callback. The final host still rechecks emitted scopes and access. CheckedNode::source_child_count and source_sibling_ordinal preserve original numeric shape and IDs without exposing denied text. They prevent pruning from changing an extended declaration into the legacy selection contract. DescriptionReservation::grow admits additional retained capacity against the same sticky request allowance; it cannot raise or reset that allowance. Public examples are checked as Rust doctests.

    Panel admission diagnostics and raw wire invariants

    Section titled “Panel admission diagnostics and raw wire invariants”

    The list-companion boundary converts only recognized unsupported panel syntax into a located unsupported descriptor; the list and its ordinary domain remain usable. Standalone search requests return the corresponding Validation error. Panel class, section icon_class and category depth are not accepted then ignored. Their values never appear in diagnostics. Unknown references, permission failures outside section pruning, exhausted budgets and database failures retain their errors. Whitespace-only domains are invalid; absent/empty source and canonical [] retain their existing meaning, while padded [] remains a declared empty domain.

    A plain relational section also requires Read access on its comodel. Unreadable sections and filters depending on denied categories disappear together. Custom callbacks receive no exemption. Section wire IDs are positive NonZeroU32 values. PanelDomain::new is internal to the adapter. PanelSection::defaults() exposes a slice. The variant fields and PanelDefaults deserialization are still raw transport: code holding &mut PanelSection can replace them. The invariant comes from the host sequence, final-host refusal of structural defaults followed by the checked overlay. The native PanelCallerDefaults::checked factory checks the actual registry model/field, value type, count, selection keys and duplicates. Its private, non-deserializable value binds the section ID, model, field and kind; set_caller_defaults accepts only that value and refuses rebinding; reserve retained storage under the request budget first. Raw DTO deserialization remains untrusted and must pass final host admission.