one2many
Order lines, BoM components, task checklists: the one2many widget is the embedded table Odoo runs on, and its options can do more than the documentation admits.
| Studio name | One2Many |
|---|---|
| Technical name | one2many |
| Field types | one2many, many2many |
| Views | form, list |
| Also registered as | many2many (same component), plus compact list.one2many and list.many2many cell variants |
| Module | web, present in every Odoo database |
| Used in core | 12 explicit occurrences across 10 modules, including product, website_slides, account_peppol, account, base_automation, calendar, plus every one2many field with no widget attribute |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0 |
| No-code setup | Yes, via Odoo Studio (Enterprise) |
| Alternatives | many2many_tags, many2many, many2many_binary, handle |
What the One2many list does
What this means for your team
Setting it up in Odoo Studio (no code)
What Studio cannot do here
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
create | boolean or domain | Allows adding lines. A domain value is evaluated against the parent record, enabling state dependent creation. ANDed with the sub view's own create attribute, and inert while the field is readonly.(default: true) |
delete | boolean or domain | Allows removing child records in one2many mode, with the same domain form and sub view ANDing as create.(default: true) |
write | boolean or domain | Gates editing of existing rows: when it resolves false the embedded renderer goes read only even though the field itself is editable. The readonly gating behavior is 19.0; the key itself was read in 18 too.(default: true) |
link | boolean or domain | Many2many mode only: allows linking existing records through the Add dialog. Ignored on one2many fields.(default: true) |
unlink | boolean or domain | Many2many mode only: allows detaching records without deleting them. Ignored on one2many fields.(default: true) |
createEdit | boolean | Read by the shared helper as a plain boolean gating the create and edit path on top of create. Undocumented, camelCase as written in the source, and unlike its siblings it takes no domain form. |
The booleans are secretly domains. For create, delete, link, unlink and write, any non boolean value is parsed as a domain and evaluated against the parent record's context, so options="{'create': [('state', '=', 'draft')]}" gates line creation by parent state, live, as the record changes. Also remember the two layer rule: the sub view's own attributes are ANDed with these options, so a <list create="false"> wins even when the option allows creation.
Working examples
crudOptions: the six keys and the two layers
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. The development branch moves crud options to field attributes and renames the kanban compiler. Details below. |
| Odoo 19.0 | Verified | Verified against the shipped source, including the domain valued options and write gating. |
| Odoo 18.0 | Verified | Same option keys via the shared helper. write did not yet drive row readonly, and kanban's add button said only Add. |
Upgrade note for 18 to 19. XML carries over, with three behavior shifts to know: the write option now drives row readonly state as described above, kanban's add button label became Add plus the field label instead of a bare Add, and expanding an unsaved new row to the full form got a proper save and resolve flow instead of a plain save. None require view changes, all affect what users see.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| no_create or no_open in options has no effect | Those are many2one options; this widget's helper reads only create, createEdit, delete, link, unlink and write. Use the x2many option names, or attributes on the sub list. |
| create is true but Add a line is missing | The sub list arch carries create="false", and the two layers are ANDed, or the field is readonly. Check both the options dict and the embedded list's attributes. |
| Rows open a dialog instead of editing inline | The embedded list has no editable attribute, and non editable lists open records in dialogs by design. Add editable="bottom" or "top" to the sub list. |
| "Please save your changes first" when expanding a line | Opening the full form requires saving the parent, and that save failed or produced inconsistent new rows. Resolve the validation errors on the parent, then expand. |
| The field shows "3 records" instead of a table | The field sits in a plain list view cell, where the compact list.one2many variant renders counts. Expected. Embedded tables belong on the form view. |
| options based create and delete rules stop working after a future upgrade | The Odoo 20 branch reads crud flags from field attributes and drops the options path. Move the rules to create, delete, link, unlink and write attributes during the migration. |
| Deleting from an embedded kanban removed the record from another list too | One2many kanban delete truly deletes the child record, unlike many2many which only forgets the link. Expected semantics; use many2many when children have a life of their own. |
One2many list vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
one2many | Child records with real data columns | Full embedded list or kanban with inline editing and per action rules |
| many2many_tags | Relations where only the name matters | Inline pills with search, no columns, no row editing |
many2many | Shared records linked, not owned | Same component in link and unlink mode with a select dialog |
| many2many_binary | File children | Upload cards instead of data rows |
| handle | Companion for reordering lines | Drag grip column inside the embedded list, not a replacement |
Frequently asked questions
Do I need widget="one2many" on a one2many field?+
How do I stop users adding or deleting lines conditionally?+
Why does options="{'no_create': True}" not work on my one2many?+
How do I make rows editable inline instead of opening dialogs?+
Can I make the lines read only but keep adding allowed?+
What is the difference between one2many and many2many rendering?+
Why does my one2many show as a count in list views?+
What changes for one2many in Odoo 20?+
Line editing that fights your sales team?
Order lines, BoMs and worksheet tables are edited hundreds of times a day, so every extra dialog and every over-locked row is paid in payroll. We tune Odoo embedded lists, edit modes, per state rules, sub view design, and prepare them for the Odoo 20 attribute migration before it lands on you.
Book a free consultation