binary
The default upload and download control for every binary field in Odoo. Its behavior is simple; the filename wiring around it is where implementations go wrong.
| Studio name | File |
|---|---|
| Technical name | binary |
| Field types | binary |
| Views | form, list |
| Also registered as | list.binary, a compact variant for list view cells |
| Module | web, present in every Odoo database |
| Used in core | 15 explicit occurrences across 12 modules, including certificate, l10n_es_edi_tbai, l10n_hu_edi, l10n_eg_edi_eta, cloud_storage_google, plus every binary field with no widget named |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0 |
| No-code setup | Yes, via Odoo Studio (Enterprise) |
| Alternatives | image, pdf_viewer, many2many_binary, Char with a URL |
What the File field 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 |
|---|---|---|
accepted_file_extensions | string | Comma separated extension list fed to the file picker's accept filter, like '.pdf,.xml'. Purely a picker convenience: it does not validate what actually arrives, and defaults to all files.(default: *) |
allowed_mime_type | string | Comma separated MIME whitelist checked at selection time. Files whose type is not in the list are refused with a danger notification naming the file. Client side only; server side enforcement needs a model constraint.(since Odoo 19.0) |
The filename is an attribute, not an option. filename="file_name_field" on the field node names the char field that stores the name. Both checks are client side conveniences: accepted_file_extensions only filters the picker dialog, and allowed_mime_type rejects files at selection time with a notification. Neither stops an API import or a determined user, so compliance grade restrictions belong on the server.
Working examples
The filename machinery, explained once
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Adds use_replace_button on the development branch; core behavior unchanged. Details below. |
| Odoo 19.0 | Verified | Verified against the shipped source. allowed_mime_type is new in this version. |
| Odoo 18.0 | Verified | Same behavior and filename wiring. accepted_file_extensions only; no allowed_mime_type. |
Upgrade note for 18 to 19. Views carry over unchanged. The single addition is the allowed_mime_type option, which did not exist in 18, so it simply becomes available after the upgrade. If a view written for 19 is backported to 18, that option is ignored.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Field displays a size like 108.55 Kb instead of the file name | No filename attribute is set, so the widget falls back to the stored value, which is the server's size placeholder. Add a companion char field and wire it with filename="..." on the binary field. |
| Uploads work but the file name is never saved | The filename attribute points at a field that is not loaded in the view. Add the companion field to the arch, invisible="1" is enough. |
| Downloaded file has no extension or a generic name | Same missing filename wiring; the download name comes from the companion field. Wire the filename attribute and re-upload, or fill the name field manually. |
| Users can still pick the wrong file type | accepted_file_extensions only filters the picker dialog and can be bypassed with All Files. Add allowed_mime_type for a client side rejection, and a server constraint for a real guarantee. |
| A wrong type import via API was accepted | Both options are browser side conveniences; the ORM does not check them. Enforce with a Python constraint on the model. |
| Very long file names appear cut off | Displayed names are capped at 255 bytes, matching filesystem limits. Expected behavior; the stored binary is unaffected. |
File field vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
binary | One file of any type per record | Plain upload and download, no preview |
| image | Pictures that should display on the record | Renders the image with resized variants instead of a name link |
pdf_viewer | PDFs users read in place | Embeds a browsable PDF preview in the form |
| many2many_binary | Several files on one record | Attachment based multi upload instead of one binary column |
Char with a URL | Files hosted outside Odoo | Stores a link only, nothing in the database |
Frequently asked questions
How do I show the real file name on an Odoo binary field?+
Why does my binary field show a file size instead of a name?+
How do I restrict which file types can be uploaded?+
Can I add a file upload field without a developer?+
Where does the file actually get stored?+
How is binary different from the image widget?+
Does the binary widget work in list views?+
What changes for binary fields in Odoo 20?+
Documents scattered across your Odoo?
Contracts on subscriptions, EDI receipts on invoices, certificates that auditors ask for by name: file handling is where clean data models earn their keep. We design document flows on Odoo, from filename wiring and server side validation to filestore strategy and portal delivery.
Book a free consultation