Skip to content
ERPForAll DocsDevelopment

    A data-only addon: no Rust, no compilation

    Planned customization through conversation

    Section titled “Planned customization through conversation”

    Prompt-authored customization is planned and is not available through a runtime API yet. Its output uses the same data-only declarations as a manually authored addon: stable external IDs, dependencies, inherited views and admitted safe action recipes. Base addon files are not edited. Immutable customization releases add preview, explicit confirmation, checked activation, export and reversal; adding reflection rows alone does not activate a supported custom field. The proposed contract is ADR 0224, extending ADR 0033.

    A custom selection value does not implement a business transition. Domain addons must expose a validated transition/policy capability before conversation can configure it. Custom action bodies retain the normal safe runtime and current-user access rules; no generated native code or arbitrary SQL is admitted in such a release. A generated release also carries no install hooks, no SQL migrations and no migration text written by the model; its only migrations are the ones the customization compiler emits and shows in the diff. A behaviour that needs code beyond that is planned as a generated WebAssembly package, built, signed and installed through the package lifecycle (proposed ADR 0229).

    Status: addons/sample_library is the worked example and is covered by crates/erp-cli/tests/sample_library.rs (install, use through the ORM, upgrade with a schema change, uninstall, demo data, a broken model file) and, for the browser Addons screen, by crates/erp-cli/tests/human_data_only_install.rs.

    A data-only addon is a folder with a manifest, model declarations in TOML and data files in XML or CSV. It has no Cargo.toml and no src/, so there is nothing to compile: put the folder in an addons path and install it (ADR 0009 §1).

    addons/sample_library/
    manifest.toml
    models/10_author.toml 15_genre.toml 20_book.toml 30_loan.toml
    security/ir.access.csv
    views/sample_library_views.xml
    demo/sample_library_demo.xml
    name = "Sample Library"
    summary = "Books, authors and loans: a sample addon with no Rust code and no compilation"
    version = "1.0.0"
    license = "MIT OR Apache-2.0"
    author = "ERPForAll"
    category = "Sample"
    application = true
    depends = ["base"]
    data = ["security/ir.access.csv", "views/sample_library_views.xml"]
    demo = ["demo/sample_library_demo.xml"]

    The module name is the folder name. data files load in the order listed (access rows first, then views, actions and menus); demo files load only when the database was created with demo data. Unknown keys are refused.

    Files are read in file-name order (hence the 10_, 20_ prefixes: book points at author). One file can hold several [[model]] tables. A new model and its fields:

    [[model]]
    name = "sample_library.book"
    description = "Library Book"
    order = "title, id"
    rec_name = "title"
    [[model.field]]
    name = "title"
    type = "char"
    required = true
    [[model.field]]
    name = "author_id"
    type = "many2one"
    comodel = "sample_library.author"
    ondelete = "restrict"
    [[model.field]]
    name = "available"
    type = "boolean"
    default = true

    To add fields to a model of another addon, write extend = "res.partner" instead of name, as the fixture crates/erp-modules/tests/fixtures/test_data_only/models/20_users.toml does. A selection field takes selection = [["draft", "Draft"], ["out", "On Loan"]]. A one2many needs comodel and inverse (an author’s book_ids, a book’s loan_ids); a many2many needs comodel and may name its table with relation, column1 and column2 (a book’s genre_ids uses the default sample_library_book_sample_library_genre_rel). In a form, a one2many shows its lines as a list taken from the comodel’s own list view and edits a line in a dialog built from the comodel’s form view; the inverse field is set from the parent and not shown. A many2many shows tags.

    The tables and columns are created at install and altered at upgrade. A mistake in a file stops the install with the file name and line, and nothing is changed.

    A model file cannot declare SQL objects: sql_function, sql_trigger, sql_condition, sql_grant and persistence, on a model or at the top of the file, are refused with an error saying that the SQL object key is native-only for now. Database functions, triggers and grants are declared by native (Rust) addons only (proposed ADR 0166, SPEC-ORMX-039).

    These are ordinary data files, exactly as in a native addon (data-files.md, views.md, actions-menus.md, access.md): ir.ui.view records with list and form architectures, ir.actions.act_window records, and menuitem elements. Access is a CSV of ir.access rows; the sample gives every internal user (base.group_user) full rights on its four models. Without a row nobody but the superuser can read or write a model.

    For a database that already exists, with the addons folder on the path:

    Terminal window
    export DATABASE_URL="postgres://erp@db.internal/postgres"
    erp module install -d mydb sample_library --addons-path ./addons

    (cli.md). The install operation registers an addon that was copied into the folder after the database was created; no separate refresh is needed (tested). The erp module command line itself was not run against sample_library in the slice that added the sample; the module-system calls it makes were.

    Browser Addons screen. A system administrator can install the addon from the Addons screen (POST /web/module/install with {"modules":["sample_library"]}; the request carries names only). The server offers the data-only addons found in its configured addons directory (the one in server.toml, addons_path; the human release copies addons/ there), so a new folder shows up without rebuilding the binary. ADR 0066, “D3 amendment (2026-10-27)”.

    A folder may hold only manifest.toml, models/*.toml, .xml and .csv files under views/, data/, demo/ and security/, and README* text files. An addon with anything else (a .sql file, migrations/, static/, a Rust crate, a symlink, another file kind, or a manifest data/demo path outside the folder or not .xml/.csv) is not offered and is refused. The server logs the path and the rule on standard error; check the log when an addon you expected is missing from the list. A broken manifest.toml anywhere in the directory makes the catalogue fail with an error rather than list partially.

    What still needs native code, or the WASM track (M2b)

    Section titled “What still needs native code, or the WASM track (M2b)”

    A data-only addon can declare models, extend models, ship views, menus, access rows, data and demo, related fields, Luau formulas and Luau hooks. It cannot:

    • add Rust methods, overrides with super, #[rpc] endpoints, constraints written in code or computed fields beyond related/Luau formulas: use a native addon today, or the WASM track (M2b) once it lands;
    • add client-side widgets or JavaScript/TypeScript code: those need an addon with a client build (see human-client-extensions.md).

    Starting from a native addon later is mechanical: the same models/, views/ and security/ folders are kept and a Cargo.toml plus src/ is added.

    Sample Library 1.0.4 adds fields so that most shipped field widgets appear in its views: a book’s summary (text), website, cover_color (char), color (integer), rating and book_format (selection), member_discount (float) and favorite (boolean), and an author’s email and phone. The widgets are chosen in the views with widget="…", as in Odoo; the model files only declare plain fields. The upgrade adds the columns and keeps existing rows; demo values for the new fields come only with a fresh install of the demo data. The list of widgets and where they appear is in the user guide page “Editing fields and field widgets”, section “Where to try the widgets”. Not yet shown in the samples: password, boolean_checkbox, boolean_icon, label_selection, badges_selection, filterable_selection, many2many_tags_avatar, many2many_tags_color_dot, daterange, code and monetary.

    Sample Library 1.0.2 displays its existing editable loan state selection in the header using widget="statusbar". Its model choices, required flag, default draft, access rows and optional demo records remain unchanged. The widget is part of web; this sample still has no compiled client or Rust code. State edits use normal Save/Discard.

    When sample_library_wasm is installed, upgrade it to 1.3.5 in the same maintenance/release train as Sample Library 1.0.2. The newer package adds its loan buttons inside the base header; older versions create another header and their combined view is refused. Copying the new source alone does not update a database’s installed views or stored WASM package. Rehearse both installed addon upgrades, including any sample_library_wasm_policy, before opening the new client for human testing. No new record data or approvals are installed by this presentation change.

    addons/contacts is a data-only application that adds no model. It shows the usual split between an addon that owns a model’s views and an addon that offers the way to reach them:

    • base owns the res.partner and res.partner.category views (addons/base/data/partner_views.xml: base.partner_list, partner_form, partner_search, partner_category_list, partner_category_form). Every addon that opens a contact from a relational field gets these as the default views.
    • contacts (depends = ["base"]) declares two window actions (contacts.action_contacts, contacts.action_contact_tags) that name those views with ir.actions.act_window.view records, and a top-level menu with web_icon="lucide:contact" whose Configuration branch is limited to base.group_system. Views are referenced across addons by their external id (ref="base.partner_list").
    • Demo contacts (demo/contacts_demo.xml: two companies with child contacts, two tags) load only with demo data. The addon defines no model, so it has no further default records.

    To add a field to the contact form from your own addon, do not edit partner_views.xml: declare an inheriting view record (inherit_id = base.partner_form, see views) in your addon. The install test crates/erp-cli/tests/contacts_install.rs lists every record of the addon by external id and checks that the views validate when installed; a view that names a field the model does not have fails the install.