Odoo 19Extra ToolsFree

Orphaned Attachment Scan

Find the attachments left behind by deleted records and uninstalled modules

The video below shows Orphaned Attachment Scan running on a real Odoo 19 database. Want it driven against your own data, or a question answered first? Ask and we will set up a session.

An attachment points at a record through res_model and res_id . There is no foreign key behind that pointer - res_id is a Many2oneReference, which Odoo's own source documents as having no FK in the database - so nothing at the database level can stop it going stale.

Deleting a record normally cleans up its attachments. Two paths do not: a child row removed by an ON DELETE CASCADE never runs Python unlink() at all, and uninstalling a module drops its models without touching a single attachment.

And then the file becomes invisible. Odoo refuses read access to an attachment whose record cannot be resolved, so an orphan never appears in any list and is not even returned by a search - the query comes back empty rather than raising. The filestore garbage collector will not help either: it removes files that have no database row, which is the opposite problem.

What it does

Tells you why, not just what

Each result is labelled Record deleted or Model uninstalled . The second kind is the one that can never be recovered by hand, because the model that gave res_id its meaning is gone.

Cautious by design

No cron, no automatic deletion, nothing running in the background. Models whose contents cannot be verified are skipped rather than guessed at - a false positive here would invite you to delete a file that was perfectly fine.

What it does not do

On a database that has never uninstalled a module and never had records removed by cascade or by hand, this app will correctly find nothing. That is the right answer, and it is worth knowing for certain rather than assuming.

Screenshots

Orphaned Attachment Scan in Odoo — screenshot scan
Orphaned Attachment Scan in Odoo — screenshot confirm

Requirements

  • Odoo 19.0, Community or Enterprise.
  • Odoo.sh or On-Premise only. Third-party apps cannot be installed on Odoo Online (SaaS) databases — check your hosting before buying.
  • Module mh_orphan_attachment_scan, version 19.0.1.0.8, licensed OPL-1.

Related apps

← All Odoo apps