Pre-alpha. No tagged release and no upgrade path between versions. Use for evaluation and development only, not production.
Core DevPre-alpha

Field attributes

Reference for the field element inside view arch XML. The Go parser (core/engine/parser/view_xml.go) and serializer (core/engine/swcmeta/arch.go) convert these attributes into JSON on arch.fields[]; SWC field widgets read that JSON at runtime.

For ORM field types (Char, Many2one, …), see Field types. For widget behaviour, see SWC widget catalog.

Attribute reference

AttributeRequiredValuesEffect
nameyesmodel field nameSelects which column to read/write. Must exist on the view's model.
stringnolabel textOverrides the model field label in this view only.
widgetnoregistry keySwaps the default control. See widget catalog.
placeholdernohint textGrey hint in empty inputs. Does not set a default value.
readonlyno1, true, yes, onField displays but cannot be edited in this view.
requiredno1, true, yes, onClient-side required validation before save (merged with model Required).
invisibleno1, true, yes, onHidden from UI; value may still load from server.
optionsnokey:value,...Widget-specific settings (see widget catalog).
groupsnoACL group xml idField hidden unless user has the group.
typepivot onlyrow, col, measurePivot/graph axis role.

Basic examples

<field name="name" string="Company name" placeholder="Acme Corp"/>
<field name="email" widget="email" placeholder="name@example.com"/>
<field name="active" widget="boolean_toggle"/>
<field name="create_date" readonly="1"/>
<field name="internal_ref" invisible="1"/>
<field name="phone" widget="phone" required="1"/>

Options syntax

options is a comma-separated list of key:value pairs (no JSON required):

<field name="state" widget="statusbar" options="clickable:1"/>
<field name="priority" widget="priority" options="mode:stars,stars:5"/>
<field name="partner_id" widget="many2one"
       options="domain:[('company_id','=', $company_id$)]"/>

The $field_name$ placeholder in domain strings is replaced at runtime with the current record value (core/swc/src/model/modifiers.ts).

One2many subview

Embed a nested list inside a one2many field:

<field name="order_line_ids">
  <list editable="bottom">
    <field name="product_id"/>
    <field name="quantity"/>
    <field name="price_unit"/>
  </list>
</field>
Subview attributeValuesEffect
editabletop, bottomInline edit row position in the embedded list

If you omit the nested , SWC auto-generates up to six scalar columns from the comodel (swcmeta/enrichOne2ManyField).

is accepted as an alias for in the parser.

Fields inside

serialize to arch.header.fields[] (e.g. statusbar). Fields in the form serialize through groups, notebook pages, and divs.

JSON shape (workspace payload)

Each field becomes an SwcArchField object:

{
  "name": "partner_id",
  "string": "Customer",
  "type": "many2one",
  "widget": "many2one",
  "relation": "res.partner",
  "placeholder": "",
  "readonly": false,
  "required": false,
  "invisible": false,
  "options": { "relation": "res.partner" }
}

See Arch JSON pipeline for the full payload.

Dynamic modifiers (*_expr)

The Go serializer (core/engine/swcmeta/arch.go) emits readonly_expr, required_expr, and invisible_expr on arch.fields[] when the XML attribute is a non-literal expression. Boolean literals (1, true, 0, false, …) stay on readonly / required / invisible. SWC's client (model/modifiers.ts) evaluates those expression strings.

<field name="partner_id" readonly="state == 'done'"/>
<field name="amount" required="type == 'invoice'"/>
<field name="reason" invisible="state != 'lost'"/>

Those become ReadonlyExpr / RequiredExpr / InvisibleExpr on the JSON field. Static flags still work:

<field name="create_date" readonly="1"/>

See also