Odoo compatibility
How concepts from Odoo Community and Enterprise correspond to ERPForAll’s native Rust crates and data-only addons, and where ERPForAll behaves differently.
ERPForAll is an ERP framework rebuilt in Rust, modeled on Odoo: a faster, leaner ORM, a clean and reactive web client, and modular addons that declare and extend models, views, menus, actions, security, and UI. While the mental model closely mirrors Odoo’s architectural concepts, ERPForAll replaces dynamic Python runtime patching with Rust’s compile-time type safety, memory safety, explicit contracts, and strict “fail loudly” error handling.
1. Concept Map: Odoo to ERPForAll
Section titled “1. Concept Map: Odoo to ERPForAll”| Odoo Concept | ERPForAll Equivalent | Mechanism / Crate | Guide Reference |
|---|---|---|---|
__manifest__.py | manifest.toml (and Cargo.toml for native crates) | Declarative TOML manifest read by erp-modules (ADR 0009, ADR 0018). Strict schema: unknown keys rejected unless under [extra]. | cli.md, cross-addon-extension.md |
models.Model, _name | #[model(name = "...")] struct | Rust struct decorated with #[model] (or [[model]] in models/*.toml for data-only addons). Associated constants for field handles. | models.md |
_inherit (in-place extension) | #[extend(TargetModel)] struct | Extension struct decorated with #[extend] in an extending crate (or [[extend]] in models/*.toml). Zero runtime cost. | cross-addon-extension.md |
_inherits (delegation) | #[model(inherits = [("model", "field")])] | Compositional delegation inheritance where parent fields are exposed transparently. | models.md#relational-fields |
Mixins (e.g., mail.thread) | Composable Rust traits & extension models | Explicit trait bounds or cross-addon extension structs rather than dynamic Python multiple inheritance. | models.md |
Fields (fields.Char, Integer, Many2one, …) | #[field(char)], #[field(integer)], #[field(many2one, comodel = "...")] | Strongly typed struct fields using erp-fields / erp-sdk. Fields are handles with associated metadata. | models.md |
@api.depends(...) | #[field(..., compute = "_method")] + #[compute(depends = [...])] | Compute methods declared in #[methods(Model)] with explicit dependency paths. | models.md#computed-fields |
@api.onchange(...) | #[onchange("field")] | Form onchange handlers returning modified field values in a ValueMap. | models.md#onchange-methods |
@api.constrains(...) | #[constrains("field")] | Validation functions returning Result<()>. Invariants checked before transaction commit. | models.md#constraints |
super().method(...) | #[method(override)] with sup: Super | Explicit method override chain using the Super dispatcher. Evaluated in deterministic dependency order. | cross-addon-extension.md, models.md#methods-and-overrides |
ir.model.access.csv + ir.rule | ir.access (security/ir.access.csv) | Unified access model (ADR 0035). Groups provide permissions (ORed); rules without groups restrict (ANDed). | security.md, access.md |
Field security (groups="...") | #[field(..., groups = "...")] | Field-level read/write permissions declared in the model and enforced by the access engine. | field-access.md, security.md |
| XML views + XPath inheritance | erp-views arch DOM & combine_view | In-memory DOM tree (ArchNode) combining parent and extension views using XPath locators and positions. | views.md |
| Data files (XML / CSV) | erp-data reader (ConvertMode) | Streaming XML and CSV reader (ADR 0019). Strict element and attribute validation with file and line diagnostics. | data-files.md |
Python server actions (state='code') | Sandboxed Luau scripts | Secure execution via crates/erp-script (ADR 0001, ADR 0009 §6/§10). Runs with caller’s rights and tight memory/step limits. | luau-scripts.md |
QWeb reports (wkhtmltopdf) | Native Typst report engine | High-performance PDF generation directly via Typst (ADR 0031). PDF/A-3 e-invoices, no headless browser. | ADR 0031 |
JSON-RPC (/web/dataset/call_kw) | JSON-2 (POST /json/2/<model>/<method>) | Explicit #[rpc(effect = ...)] methods (ADR 0038). Effect classes (read, write, destructive, external), idempotency keys. | rpc.md |
res.users._check_credentials, ir.config_parameter.get_param, _post_logout | _check_credentials(Arc<Credential>, CheckEnv) -> AuthInfo override with super; typed get_str/int/float/bool; session_end_hook! | Password login, sessions and the database settings. A malformed setting is an error, not a default; database.secret is unreadable without full elevation. | auth.md |
2. Key Differences in Detail
Section titled “2. Key Differences in Detail”Manifest and Addon Declaration
Section titled “Manifest and Addon Declaration”In Odoo, an addon is identified by __manifest__.py. In ERPForAll:
- Native Addon: A Rust crate with a
Cargo.tomland amanifest.toml. The crate root callserp_sdk::addon!(name = "sale_stock", depends = ["sale", "stock"]);as documented in models.md (“Declaring an addon”). Notice thatbaseis always an implicit dependency inerp_sdk::addon!, sodependslists only explicit non-base addon dependencies. Inmanifest.toml,depends = ["base", "other_addon"]. - Data-Only Addon: A plain directory containing
manifest.toml,models/*.toml, and data files (XML/CSV) without Rust compilation (see cross-addon-extension.md).
name = "Library Extension"summary = "Extend library book with borrowing features"version = "1.0.0"depends = ["base", "test_ext_a"]data = [ "security/ir.access.csv", "views/book_views.xml",]Models and Extension
Section titled “Models and Extension”In Odoo, models.Model classes are dynamically instantiated and monkey-patched at runtime via _inherit.
In ERPForAll:
- A new model is defined with
#[model(name = "tech.name", description = "Label")] pub struct ModelName;. - Extending an existing model from another addon is defined in the extending crate using
#[extend(ParentModel)] pub struct ExtensionStruct;. - The Rust struct acts as a compile-time declaration tag. Record operations use
RecordSet<ModelName>, and fields are accessed via generated typed associated constants (such asBook::NAMEorBookPages::PAGES).
Methods and super() Dispatch
Section titled “Methods and super() Dispatch”In Odoo, method inheritance uses Python’s cooperative super() and method resolution order (MRO):
# Odoo Pythonclass Book(models.Model): _inherit = "library.book"
def describe(self): res = super().describe() return f"{res}, {self.pages} pages"In ERPForAll, method overrides are declared explicitly with #[method(override)] and accept a sup: Super parameter:
// ERPForAll Rust (from crates/erp-test-models/addons/test_ext_b)#[methods(Book)]impl BookPages { #[method(override)] async fn describe(this: &RecordSet<Book>, tx: &mut Transaction, sup: Super) -> Result<String> { let pages = this.get(tx, BookPages::PAGES).await?; Ok(format!( "{}, {pages} pages", sup.call(tx, this.as_records(), ()).await? )) }}The override order is strictly deterministic: (depth, order_name) based on the dependency graph, identical after install, upgrade, or server restart (ADR 0009 §3).
Security and Access Control
Section titled “Security and Access Control”Odoo historically splits access into ir.model.access.csv (table-level CRUD permissions) and ir.rule XML records (row-level domain filters).
In ERPForAll (ADR 0035), both permissions and restrictions are unified into the ir.access format (matching Odoo 20’s consolidated design):
id,name,model_id,group_id/id,operation,domainaccess_rental_user,Rental User,test_ext.rental,base.group_user,r,access_rental_manager,Rental Manager,test_ext.rental,base.group_system,crud,rental_own_branch,Rentals in own branch,test_ext.rental,,crud,"[('company_id', 'in', company_ids)]"- Rows with a group grant permissions (
ORed across all groups held by the user). - Rows without a group impose restrictions (
ANDed across all users). - Operation spelling follows Odoo 20’s 15 non-empty subsets of
crudin strictc, r, u, dorder (ccreate,rread,uupdate/write,ddelete/unlink). Any unrecognized character (such asw) or out-of-order string fails parsing loudly withRowError::InvalidOperation. - Access domains compile directly into PostgreSQL SQL parameters (
$uid,$company_ids,$now), evaluated once by the query planner rather than record-by-record in memory.
3. Worked Example: Extending an Addon Model and Defining a New Model
Section titled “3. Worked Example: Extending an Addon Model and Defining a New Model”This worked example demonstrates extending an addon using the exact crate structure, workspace conventions, and compiled patterns from crates/erp-test-models/addons/test_ext_a and test_ext_b (documented in cross-addon-extension.md).
The extending addon (test_ext_b, package erp-addon-test_ext_b) extends the base addon (test_ext_a, package erp-addon-test_ext_a):
- Manifest and Cargo configuration: Declares workspace package dependencies and metadata.
- New model (
test_ext.rental): Declares a new model with relational and scalar fields. - Model extension (
BookPages): Adds fields (pages,isbn) totest_ext_a::Book. - Method override: Overrides
Book::describeto include page count viasup: Super. - View extension: Injects the new fields into the book form view via XPath.
- Access rules: Grants permissions in
security/ir.access.csv.
Step 1: Addon Manifest and Cargo Crate Setup
Section titled “Step 1: Addon Manifest and Cargo Crate Setup”Reference documentation: cli.md, cross-addon-extension.md.
Declare crate dependencies in Cargo.toml using workspace inheritance (edition 2024):
[package]name = "erp-addon-test_ext_b"description = "ERPForAll fixture addon test_ext_b: cross-crate model extension"version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truerepository.workspace = truepublish.workspace = true
[dependencies]erp-sdk = { workspace = true }erp-addon-test_ext_a = { workspace = true }
[lints]workspace = trueDeclare module metadata in manifest.toml:
name = "Test Ext B"summary = "Fixture: extends test_ext.book from a separate crate"depends = ["base", "test_ext_a"]data = [ "security/ir.access.csv", "views/book_views.xml",]Step 2: Defining a New Model (test_ext.rental)
Section titled “Step 2: Defining a New Model (test_ext.rental)”Reference documentation: models.md.
The new model uses strongly typed fields with types that implement ValueFor<K> from erp-fields / erp-orm (Option<Arc<str>> for char, Option<Date> for date, Many2one<Book> for many2one):
use erp_addon_test_ext_a::Book;use erp_sdk::prelude::*;
#[model(name = "test_ext.rental", description = "Book Rental")]pub struct Rental { #[field(char, required = true)] pub name: Option<Arc<str>>,
#[field(many2one, comodel = "test_ext.book", required = true, ondelete = "cascade")] pub book_id: Many2one<Book>,
#[field(date)] pub rental_date: Option<Date>,
#[field(selection, selection = [("active", "Active"), ("returned", "Returned")], default = "active")] pub state: Option<Arc<str>>,}Step 3: Extending an Existing Model (test_ext_a::Book)
Section titled “Step 3: Extending an Existing Model (test_ext_a::Book)”Reference documentation: cross-addon-extension.md, models.md#computed-fields.
The following snippet is taken verbatim from crates/erp-test-models/addons/test_ext_b/src/lib.rs (which builds and runs in CI):
use erp_addon_test_ext_a::Book;use erp_sdk::prelude::*;
/// B's extension of `test_ext.book`.#[extend(Book)]pub struct BookPages { /// Number of pages. #[field(integer)] pub pages: i32, /// ISBN, with an explicit label. #[field(char, string = "ISBN")] pub isbn: Option<Arc<str>>,}If a computed field is needed on an extension (e.g. is_rented), declare on the struct the fields it needs —
#[field(one2many, comodel = "test_ext.rental", inverse_name = "book_id")] pub rental_ids: Vec<RecId> and
#[field(boolean, compute = "_compute_is_rented", store)] pub is_rented: bool — and implement
#[compute(depends = [...])] in #[methods(Book)] using Assign<'_, Book> (illustrative; not part of the fixture crate):
#[methods(Book)]impl BookPages { #[compute(depends = ["rental_ids.state"])] async fn _compute_is_rented( this: &RecordSet<Book>, tx: &mut Transaction, out: &mut Assign<'_, Book>, ) -> Result<()> { let rentals = this.mapped(tx, BookPages::RENTAL_IDS).await?; for (i, book_rentals) in rentals.iter().enumerate() { let states = book_rentals.mapped(tx, Rental::STATE).await?; let active = states.iter().any(|s| s.as_deref() == Some("active")); out.set(i, BookPages::IS_RENTED, active)?; } Ok(()) }}Step 4: Overriding a Method on Book
Section titled “Step 4: Overriding a Method on Book”Reference documentation: cross-addon-extension.md, models.md#methods-and-overrides.
Taken verbatim from crates/erp-test-models/addons/test_ext_b/src/lib.rs:
// addons/test_ext_b/src/lib.rs (continued)#[methods(Book)]impl BookPages { /// Appends the page count to the result of the next implementation. #[method(override)] async fn describe(this: &RecordSet<Book>, tx: &mut Transaction, sup: Super) -> Result<String> { let pages = this.get(tx, BookPages::PAGES).await?; Ok(format!( "{}, {pages} pages", sup.call(tx, this.as_records(), ()).await? )) }}Declare the addon at the top of src/lib.rs (the fixture keeps everything in one file; a larger addon splits
models into modules):
use erp_sdk::prelude::*;
erp_sdk::addon!(name = "test_ext_b", depends = ["test_ext_a"]);Step 5: View Extension
Section titled “Step 5: View Extension”Reference documentation: views.md.
Extend the book form view using XPath to inject pages and isbn after name:
<erp> <record id="view_book_form_ext" model="ir.ui.view"> <field name="name">test_ext.book.form.inherit</field> <field name="model">test_ext.book</field> <field name="inherit_id" ref="test_ext_a.view_book_form"/> <field name="arch" type="xml"> <xpath expr="//field[@name='name']" position="after"> <field name="pages"/> <field name="isbn"/> </xpath> </field> </record></erp>Step 6: Security Access Rules
Section titled “Step 6: Security Access Rules”Reference documentation: security.md, access.md.
Define access grants in security/ir.access.csv:
id,name,model_id,group_id/id,operation,domainaccess_rental_user,Rental User,test_ext.rental,base.group_user,r,access_rental_manager,Rental Manager,test_ext.rental,base.group_system,crud,rental_own_branch,Rentals in own branch,test_ext.rental,,crud,"[('company_id', 'in', company_ids)]"4. Company consistency
Section titled “4. Company consistency”Odoo’s company flags map one to one: _check_company_auto, check_company=True, _check_company_domain
(here company_match) and with_company keep their meaning. What differs is the default and a few
guarantees, all recorded in ADR 0044; the details are in company-consistency.md.
| Area | Odoo | ERPForAll |
|---|---|---|
| Check on by default | A link is checked only when the model sets _check_company_auto and the field sets check_company=True; a forgotten flag is a silent cross-company link. | Every stored many2one/many2many of a company-scoped model whose comodel is company-scoped is checked. Opt out with check_company_auto = false on the model or check_company = false on the field (Odoo’s behaviour exactly). A flag on a model without company_id/company_ids fails the registry build instead of being logged and skipped. |
| Related reads | A related field is read as superuser (related_sudo), so a user in company A reads a value through a record of company B. | A related field that does not declare compute_sudo is read as superuser for permissions but only through records of the active companies (or of none), including the record its last relational field points to; a hop outside fails with Access. compute_sudo = true is the opt-out, compute_sudo = false the read as the caller. An explicit sudo() read keeps Odoo’s value. |
Validation under sudo() | sudo() takes the ids of allowed_company_ids as given, so a company the user is not in is accepted. | Company membership is validated under every elevation (One of the selected companies does not exist or is not one of yours.); the same check as for an unelevated environment. |
| Duplicate ids | allowed_company_ids=[1, 1] is accepted. | A duplicated id is a Validation error naming it. |
| Names in errors | Display names in the inconsistency error and in the debug listing of an access error are read as superuser. | Names are read as the caller; an unreadable record is written <model>(<id>,). The debug listing shows a name only for records without company or in one of the principal’s active companies, and never names a company the user is not in. The hint texts and suggested_company are Odoo’s. |
System principal | The superuser takes any company list as given. | Kept for the System principal the core creates. with_user(SUPERUSER_ID) from any other principal is refused (ADR 0164 A4, SPEC-PRIN-029): the environment stays the caller’s own user, with that user’s companies. |
Checklist: a link across companies on purpose gets check_company = false; a related field that
must show a value across companies (a partner’s country on a document of another company) gets
compute_sudo = true; a sudo().with_company(other) that relied on other being unchecked must be
a company the user belongs to.
Company contact fields
Section titled “Company contact fields”res.company exposes street, street2, zip, city, email, phone, website and vat as writable
related fields of partner_id (related = "partner_id.street", readonly = false, compute_sudo = true, so
whoever may read the company reads these values, as in Odoo), so a read returns the
company partner’s value and a write changes the partner. Known limit: a value the partner normalises on write (a
bare website gets http://) reads back as written on the company until the next transaction. Odoo does the same, except that it stores email and
phone on the company and computes the address from the partner. Creating a company with a name and no
partner_id creates the partner and passes the contact values to it. country_id, state_id, logo and the
report fields are not available yet; see docs/specs/base/company.md, section 4.7. An addon adds its own company
contact field the same way: another related field plus an entry in the Settings > Companies form view. The
company name does not follow the partner’s name yet (SPEC-PARTNER-060 is not implemented).
5. Differences That Fail Loudly
Section titled “5. Differences That Fail Loudly”Under the ERPForAll engineering standards, silent fallbacks, ignored errors, and permissive defaults are forbidden. The following table highlights common Odoo behaviors that fail loudly in ERPForAll:
| Area | Odoo Behavior | ERPForAll Fail-Loudly Contract | Relevant ADR |
|---|---|---|---|
| Manifest Parsing | Broken __manifest__.py files or missing keys are logged at DEBUG or silently cause the module to vanish from the list. | Any syntax error, unknown key outside [extra], wrong value type, or invalid version stops startup with an error. | ADR 0018 §1–2 |
| Missing Dependencies | Modules with missing dependencies are silently skipped or dropped from the installation graph. | Discovery reports an explicit error listing all missing dependency chains and cycles. | ADR 0018 §5 |
| Data File Schema | Unrecognized XML tags or attributes are ignored; misspelled attributes (modle=, <feild>) pass silently. | Parser strictly enforces the element and attribute allowlist (RNG schema); unknown elements abort loading with file and line. | ADR 0019 §3 |
| Boolean Attributes | Any arbitrary string in a boolean attribute (e.g. noupdate="unknown") evaluates to True via str2bool. | Only 1/0, true/false, yes/no, on/off are accepted; anything else fails loading immediately. | ADR 0019 §2 |
| Comments in Values | XML comments inside text values (e.g. <field>A<!-- c -->B</field>) silently drop content after the comment. | Comments inside raw text field values are rejected loudly. | ADR 0019 §3 |
| Expression Evaluation | Python expressions in eval can fail at runtime or invoke unmonitored builtins. | erp-expr parses expressions at build/install time; unexposed attributes or variables fail immediately (UnknownAttribute). | ADR 0020 §1–3 |
| RPC Exposure | All public Python methods (not prefixed with _) are callable over RPC unless @api.private is added. | Methods are private by default; calling an unexposed method over RPC returns 403. Only explicit #[rpc] methods are callable. | ADR 0038 §1, ADR 0004 |
| RPC Effect Violations | A @api.readonly method that writes to the database emits a warning and silently replays on a read/write cursor. | Calling a method marked #[rpc(effect = read)] that attempts a database write fails loudly with a transaction error. | ADR 0038 §2 |
| Translated View Selectors | Extension views can match elements by translated strings (<button string="Save">), breaking under other locales. | Locating elements by translatable attributes (string="...") is strictly forbidden and rejected by erp-views. | ADR 0027, erp-views |
| Server Action Permissions | Server actions for object_write, object_create, etc., silently run with superuser privileges. | All server actions run with caller rights unless an explicit, administrator-assigned run_as_superuser flag is present. | ADR 0001, ADR 0009 §10 |
| PostgreSQL Version Gate | Server starts on older PostgreSQL releases (9.6+) and fails later with obscure syntax errors or degraded queries. | Connection pool post-create hook enforces PostgreSQL 18+ (server_version_num >= 180000), refusing older servers with a typed error naming ADR 0028 and warning on PG19+. | ADR 0028 §1 |
| Required Database Extensions | Missing extensions (e.g. pg_trgm) silently cause trigram indexes to be skipped or fall back to sequential scans. | Schema sync and DDL require declared extensions: declaring a trigram index (index = "trigram") when pg_trgm is not installed fails loudly with MissingExtensionError (Programming error). | ADR 0028 §3 |
| Installation Atomicity | Odoo commits after each module during multi-module install; a mid-way failure leaves a partially installed database. | Install, upgrade, and uninstall execute in a single PostgreSQL transaction (all-or-nothing rollback on any failure). | ADR 0009 §2 |
| Result Dictionaries | values['x'] on a missing key raises KeyError; any code can add a key of any type to any row dict. | Result rows are batches with one shared layout (erp_fields::rows): reading a key the rows do not have, a key absent in that row, or a row past the end is a Programming error naming the key, the row and the model; get_opt and contains are the explicit tests. Read a row like a dict with value.dict() (get, get_opt, contains, keys, iter, len), for Value::Map and Value::Row alike. Value is #[non_exhaustive]: an addon’s match on it ends with an arm that returns an error, never one that turns an unknown value into a normal one. The Rows override API (set, insert_key, remove_key, children_mut, from_maps) reaches web_read and read overrides in a later delivery. | ADR 0052 |
6. Platform Status and Slices
Section titled “6. Platform Status and Slices”Available Today on Main
Section titled “Available Today on Main”Features already functional on main for addon developers:
- Module discovery & CLI: Addon discovery, dependency graph resolution, manifest validation, and developer CLI commands (
erp module install,upgrade,uninstall,scaffold,dev). - Module Lifecycle in DB: Transactional install, upgrade, uninstall and dependency graph in PostgreSQL.
- Security & Access Policy: Access policy compilation from
ir.accessinto SQL predicates, group inheritance closure, and field-levelgroupsenforcement (follow-up open).
Not Yet Available (Roadmap & Slices)
Section titled “Not Yet Available (Roadmap & Slices)”The table below lists features that are designed or under active development on the board, with their current state and what is still to come:
| Feature | Current State | Still to come | Description |
|---|---|---|---|
| Database Data Loading | Parser (erp-data) merged | planned | Loading XML/CSV records into PostgreSQL, external IDs (ir.model.data), noupdate tracking. |
| View & Menu DB Storage | Arch engine (erp-views) merged | planned | Storing and resolving ir.ui.view and ir.ui.menu records in the database. |
| Migrations | ADR 0009 §2 designed | planned | Migration execution engine, MOD-036..039. |
Packaged Addons (.erpaddon) | Native crates merged; plan done | in progress | Distributable ZIP archive packages and WASM component isolation (ADR 0001, ADR 0009). |
| HTTP JSON-2 RPC Server & Auth | In-process dispatch merged; password login and session rows (auth.md) | HTTP server and API key authentication (planned) | HTTP listener for /json/2/<model>/<method>, session cookies, API key authentication. |
| Web Client UI | Specifications & plan defined | in progress | Core web client shell, reactive views (form, list, kanban, search, pivot, graph, calendar, gantt), widget registry. |
| Native Typst PDF Reports | ADR 0031 accepted; specs done | implementation planned in ADR 0031 | High-performance QWeb-to-Typst PDF report generation engine with PDF/A-3 support. |
7. Backward Compatibility and Deprecation Policy (ADR 0096)
Section titled “7. Backward Compatibility and Deprecation Policy (ADR 0096)”Unlike Odoo where upgrades between minor and major versions frequently break custom addon signatures, model field structures, and view inheritance without advance warning, ERPForAll enforces strict, machine-verified backward compatibility across minor releases (1.x):
- Additive Public APIs: Core framework APIs (
erp-sdk,erp-orm,erp-modules,erp-fields,erp-expr, etc.) must remain backward-compatible and additive within a minor series (1.x). Breaking method signatures or removing public API items within a minor series is strictly prohibited. - Compiler-Driven Deprecation Lifecycle: When an API is superseded, it must be annotated with
#[deprecated(since = "1.X.0", note = "...")]directing developers to the preferred replacement. Deprecated APIs remain fully operational and tested for at least one complete minor release cycle before removal (or until 2.0). - Automated CI Compatibility Matrix (
scripts/ci-compat.sh): A dedicatedcompatstep runs in CI underscripts/ci.sh. It extracts the baseline two-addon extension suite fromcompat-baseline(which becomesv1.0.0at the 1.0 release) and compiles and executes it against the current core codebase using an offline, local runner that reuses the workspace target directory. Deprecation warnings are emitted and reported in build logs, while any compiler error or runtime test regression fails CI loudly.