many2one_binary
New in Odoo 20. It turns a many2one pointing at an attachment into a file upload box, so users drop a file rather than picking a record they never think of as a record.
September 18, 2026Updated September 18, 20264 min read
| Technical name | many2one_binary |
|---|---|
| Field types | many2one |
| Views | form |
| Module | web, present in every Odoo 20 database |
| Used in core | 6 uses across Odoo 20 Community and Enterprise views, excluding tests. Does not exist in Odoo 19. |
| Versions | Odoo 20.0 |
| No-code setup | No Studio entry, though its one option is properly declared. |
| Alternatives | binary, many2many_binary, many2one, image |
What the many2one_binary widget does
What this means for your team
Supported options in Odoo 20
| Option | Type | What it does |
|---|---|---|
accepted_file_extensions | string | Comma-separated extension list passed to the file picker, for example '.pdf,.docx'. A client-side filter that shapes what the browser offers rather than what the server accepts, so it is convenience rather than validation.(since Odoo 20.0) |
accepted_file_extensions is a client-side hint that populates the file picker's filter. It shapes what the browser offers, not what the server accepts, so a determined user can still submit something else. Treat it as convenience, not validation.
Working examples
What happens when an upload fails
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 19.0 | Not available | Does not exist. A many2one to an attachment renders as a record selector. |
| Odoo 20.0 | Verified | Introduced in Odoo 20. Verified against the shipped 20.0 source. |
This widget does not exist before Odoo 20.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| A class set in options does nothing | className is read from the class attribute, not from the options dictionary. Move it onto the field tag: class="your-class". |
| A user uploaded a file type you meant to block | accepted_file_extensions filters the browser's picker only; it is not server-side validation. Validate the mimetype server-side if the restriction matters. |
| The upload area shows even with no file attached | isEmpty is hardcoded to false, so the field is never treated as empty. Working as designed. It is an upload target, so it has to be visible. |
| An upload failed with a red notification and nothing saved | The server rejected the file; the widget surfaces the message and stops rather than throwing. Read the notification text, which carries the server's own reason. |
Many2one_binary widget vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
many2one_binary | A single linked attachment users should upload, not look up | File picker over a many2one, with graceful upload failure |
| binary | A file stored directly on the record | No attachment relation to manage |
| many2many_binary | Several attachments on one record | Multiple files rather than one |
| many2one | A genuine record relation | Record selector rather than file picker |
| image | A stored image | Image preview and cropping rather than a file list |
Frequently asked questions
How do I make an Odoo many2one to an attachment behave like a file upload?+
How do I restrict which file types can be uploaded?+
Why is my class option ignored?+
What happens if an upload fails?+
Attachments your users cannot find?
Linking files through ir.attachment is the right model and the wrong interface until somebody fixes the field. We build document handling in Odoo so uploading, finding and replacing a file takes one action each.
Book a free consultation