Skip to content

API Reference parrot_formdesigner.core.relations

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.core.relations

View source

Relational field aspect data models.

This module defines EntityRef and RelationSpec, the two Pydantic models used to express relational semantics (Many2one, Many2many, and One2many, in Odoo terms) as an optional aspect on FormField — see FormField.relation in :mod:parrot_formdesigner.core.schema (wired in a later module; this module is intentionally leaf-level and imports nothing else from the package).

Namespace conventions for EntityRef.namespace (free-form, documented only — unknown namespaces are allowed by design and simply ignored by consumers that do not recognize them):

  • "odoo" — an Odoo model name (e.g. "res.partner") as entity.
  • "db" — a database table, typically schema.table (e.g. "public.customers") as entity.
  • "api" — an external API resource identifier as entity.
  • "formdesigner" — another parrot-formdesigner form, with entity set to that form's form_id.

Class EntityRef

Identifies the target entity of a relation.

Fields:

Field Type Default Description
namespace str Free-form namespace identifying the kind of target (documented conventions: "odoo", "db", "api", "formdesigner"; unrecognized namespaces are permitted by design — there is no central registry, and consumers that do not recognize a namespace simply ignore the relation).
entity str The target entity identifier within namespace (e.g. "res.partner", "public.customers", or a form_id when namespace == "formdesigner").
key_field str | None None The target's key field to use for identity. None means the target's default key (e.g. its primary key).

Class RelationSpec

Relational semantics of a field's value, orthogonal to field_type.

Fields:

Field Type Default Description
cardinality Literal['one', 'many'] "one" for a single reference (Many2one), "many" for multiple references (Many2many) or embedded child rows (One2many).
target EntityRef The :class:EntityRef this relation points to.
mode Literal['reference', 'embed'] 'reference' "reference" for a field whose value is an ID (or list of IDs) pointing at target; "embed" for a field whose value is a list of embedded child rows owned by the parent record (One2many), reusing the existing ARRAY + item_template machinery.
display_field str | None None Optional target field shown to users in place of the raw ID (e.g. a partner's name).
inverse_field str | None None In embed mode, the child field that points back to the parent record. Required when mode == "embed".
on_delete Literal['restrict', 'cascade', 'set_null'] | None None Passthrough hint only — "restrict", "cascade", or "set_null". Not enforced in v1; interpretation is left to the consumer (e.g. an Odoo renderer/toolkit).
filters dict[str, Any] | None None Consumer-interpreted filters narrowing the target set (e.g. restrict option fetching to active records only). Not interpreted by parrot-formdesigner itself.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally