mail_attachments
The attachment list on Odoo's invoice send wizard. It knows the difference between a file you added, a file the system generated, and a file that must not be deleted, and it cleans up after itself when you close the wizard.
| Technical name | mail_attachments |
|---|---|
| Field types | json |
| Views | form |
| Module | account, present wherever Invoicing or Accounting is installed |
| Used in core | 1 occurrence, the document send wizard in account |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0 |
| No-code setup | No. The field holds a structured value the server builds |
| Alternatives | many2many_binary, mail_composer_attachment_list, binary, account_batch_sending_summary |
What the mail attachments field does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
placeholder | flag on each entry | Marks a document that will be generated at send time. Removing it keeps the entry and sets a skip marker instead of deleting anything.(default: false) |
protect_from_deletion | flag on each entry | Marks a file that must not be deleted. Removing it behaves the same as a placeholder: kept and skipped.(default: false) |
manual | flag on each entry | Marks a file the user uploaded in this wizard. If the wizard is closed without being saved, every entry with this flag is deleted.(default: false) |
attachments_not_supported | companion field | Read by literal name and not declared as a dependency. Maps attachment identifiers to the reason a document cannot be sent, shown as a tooltip. |
One companion field is read by literal name. The tooltips shown on unsupported documents come from a field holding a mapping from attachment identifier to explanation. The widget declares no dependency on it, so a custom wizard has to load it; when it is absent, the files render with no tooltips and nothing else breaks.
Working examples
Three flags, one deletion queue, and a cleanup on close
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Byte-identical to Odoo 19 on the development branch. |
| Odoo 19.0 | Verified | Verified against the shipped source. Presentation helpers removed and accessors turned into getters. |
| Odoo 18.0 | Verified | Same removal rules and cleanup, with the presentation helpers still in the component. |
| Odoo 17.0 | Verified | First version. |
| Odoo 16.0 | Not available | Widget does not exist. |
Upgrade note. No view change is needed between Odoo 17 and Odoo 19. Odoo 19 removed presentation helpers from the component and turned two methods into getters, which matters only to custom code that called them. The entry structure and the removal rules are the same throughout.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| A removed document came back next time | It was a placeholder or a protected file, so removing it only marked it to be skipped for that send. Expected. Remove it again on the next wizard, or change the setting that attaches it. |
| Uploaded files disappeared | The wizard was closed without being saved, and every manual upload is deleted in that case. Complete the wizard, or re-upload after saving. |
| No tooltips on unsupported documents | The wizard does not load the companion field the widget reads by literal name. Add that field to the wizard model and the view. |
| Orphan attachments in the database | Something closed the form in a way that did not unmount the component. The cleanup runs on unmount; check for a customization that keeps the component alive. |
| Options are ignored | The registration has no extractor, so nothing in the options dictionary is read. Nothing to configure here. |
| Missing widget error | The accounting module is not installed in that database. Install Invoicing or Accounting. |
Mail attachments field vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
mail_attachments | Wizards mixing uploaded files with documents that do not exist yet | A structured file list with placeholder and protected entries, plus a deletion queue drained on close |
| many2many_binary | An ordinary list of attached files | Backed by a real relation, so it cannot represent a document still to be generated |
| mail_composer_attachment_list | Attachments inside the mail composer | Removes the upload button and unlinks composer attachments on removal |
| binary | A single file on a record | One field, one file, no list |
| account_batch_sending_summary | Summarizing what a batch send will do | A read-only panel with no file management |
Frequently asked questions
Why does removing the invoice PDF not remove it permanently?+
What happens to files I uploaded if I close the wizard?+
When are the deletions actually performed?+
Where do the tooltips come from?+
Does it support any options?+
Invoice delivery that does not need a follow-up call
Attachments, terms and conditions, electronic invoicing files and the customer settings behind them decide whether an invoice arrives usable. We configure and test document sending in Odoo on versions 16 through 19.
Book a free consultation