OdooWiki OCA HUB

AutoVacuum Mail Message and Attachment

autovacuum_message_attachment folder_open OCA/server-tools open_in_new
Tools License: LGPL-3

Odoo create a lot of message and/or mails. With time it can slow the system or take a lot of disk space. The goal of this module is to clean these message once they are obsolete. The same may happen with attachment that we store. You can choose various criterias manage which messages you want to delete automatically.

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Create rules that automatically delete old mail messages and attachments after a chosen number of days, to keep the database small. Rules are managed from the Email menu and run by two daily scheduled jobs.

This module adds a new screen called "Message and Attachment Vacuum Rule" under the Email menu. There you create rules that decide which old messages or attachments Odoo should delete automatically.

Each rule has a type: Message or Attachment. You set a retention time in days (default 365); records older than that become eligible for deletion. For messages you can restrict by message type (email, comment, system notification, user notification or all), by message subtypes, and by models. For attachments you can restrict by a filename pattern, by models, and by an inheriting model.

Two scheduled jobs, "AutoVacuum Mails and Messages" and "AutoVacuum Attachments", run daily but are inactive by default; you must enable them. They apply the rules and delete matching records in batches of 1000, committing after each batch.

Business rules: retention time cannot be 0 days; an inheriting model can only be used on attachment rules and must really be linked to attachments. Rules can be archived. Only system administrators can manage them. The module touches mail.message, ir.attachment and adds an "Assigned Attachments" list on all models.

Depends on

mail

Menus it adds

menu_action_vacuum_rule
Models and fields (5)
  • base · extends an existing modelassigned_attachment_ids (Assigned Attachments)
  • vacuum.rule · new modelname, model (Model code), ttype (Type), active, model_id, model_ids (Models), company_id (Company), description, empty_model, message_type, empty_subtype, retention_time, filename_pattern, inheriting_model, message_subtype_ids (Subtypes), model_filter_domain
  • mail.message · new model
  • ir.attachment · new model
  • autovacuum.mixin · new model

Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 5 confirmed, 4 with no information of 9 versions.

Sources · Odoo 12.0

Confirmed on 2026-11-03 in branch 12.0 of OCA/server-tools.

terminal Installation and usage

OCA documentation · Odoo 18.0
  • Go to the menu configuration =\> Technical =\> Email =\> Message And Attachment Vacuum Rules
  • Add the adequates rules for your company. On each rule, you can indicate the models, type and subtypes for which you want to delete the messages, along with a retention time (in days). Or for attachment, you can specify a substring of the name.
  • Activate the cron AutoVacuum Mails and Messages and/or AutoVacuum Attachments

It is recommanded to run it frequently and when the system is not very loaded. (For instance : once a day, during the night.)

No verified information in OCA: Installation, Usage.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.