Records Archiver

record_archiver
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/11.0/record_archiver
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYmisc
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSoca-travis, OCA-git-bot, Artem Kostyuk
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:24:00
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - base
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (2)
XML IDNameModelTypeStatus
view_record_lifespan_search record.lifespan.search record.lifespan search New
view_record_lifespan_tree record.lifespan.tree record.lifespan tree New
Models touched (2)

New fields (1)
  • has_an_active_field Boolean
    compute=_compute_has_an_active_field search=_search_has_an_active_field string='Has an active field'
Public methods (0)

No public methods.

New fields (4)
  • archive_states Char
    help="Comma-separated list of states in which records should be archived. Implicit value is `'done, cancel')`."
  • model_id Many2one → ir.model
    domain=[('has_an_active_field', '=', True)] required=True string='Model' args: 'ir.model'
  • model_name Char
    readonly=True related='model_id.model' string='Model Name'
  • months Integer
    help='Number of month after which the records will be set to inactive based on their write date' required=True
Public methods (1)
  • archive_records(self)
    @api.multi
    Call the archiver for several record lifespans.
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/9.0/record_archiver
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYmisc
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSYannick Vaucher, Guewen Baconnier, Stéphane Bidoul (ACSONE), oca-travis, OCA-git-bot
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:15:22
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - base
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (2)
XML IDNameModelTypeStatus
view_record_lifespan_search record.lifespan.search record.lifespan search New
view_record_lifespan_tree record.lifespan.tree record.lifespan tree New
Models touched (2)

New fields (1)
  • has_an_active_field Boolean
    compute=_compute_has_an_active_field search=_search_has_an_active_field string='Has an active field'
Public methods (0)

No public methods.

New fields (3)
  • model Char
    related='model_id.model' store=True string='Model Name'
  • model_id Many2one → ir.model
    domain=[('has_an_active_field', '=', True)] required=True string='Model' args: 'ir.model'
  • months Integer
    help='Number of month after which the records will be set to inactive based on their write date' required=True
Public methods (1)
  • archive_records(self)
    @api.multi
    Call the archiver for several record lifespans
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/7.0/record_archiver
VERSION
VERSION 0.1
CATEGORY
CATEGORYmisc
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSGuewen Baconnier
WEBSITE
WEBSITEwww.camptocamp.com
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:07:15
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - base
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION
Records Archiver
================

Create a cron job that deactivates old records in order to optimize
performance.

Records are deactivated based on their last activity (write_date).

Configuration
=============

You can configure lifespan of each type of record in
`Settings -> Configuration -> Records Archiver`

A different lifespan can be configured for each model.

Usage
=====

Once the lifespans are configured, the cron will automatically
deactivate the old records.

Known issues / Roadmap
======================

The default behavior is to archive all records having a ``write_date`` <
lifespan and with a state being ``done`` or ``cancel``. If these rules
need to be modified for a model (e.g. change the states to archive), the
hook ``RecordLifespan._archive_domain`` can be extended.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_.  In case of trouble,
please check there if your issue has already been reported.  If you
spotted it first, help us smashing it by providing a detailed and
welcomed feedback `here
<https://github.com/OCA/server-tools/issues/new?body=module:%20record_archiver%0Aversion:%207.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.


Credits
=======

Contributors
------------

* Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.
 

Code Analysis

Views touched (2)
XML IDNameModelTypeStatus
view_record_lifespan_search record.lifespan.search record.lifespan search New
view_record_lifespan_tree record.lifespan.tree record.lifespan tree New
Models touched (2)

New fields (0)

No new fields.

Public methods (0)

No public methods.

New fields (0)

No new fields.

Public methods (1)
  • archive_records(self, cr, uid, ids, context=None)
    Call the archiver for several record lifespans