Ahrimann Steiner
Ahrimann Steiner

Reputation: 1314

Data Cleaning in Odoo (notifications, website-visitors...)

I have noticed that my Odoo16-Database size has drastically grown over the last months. And i want to clear all the obsolete records of all involved models (notifications, web visitors...).

The Odoo - Data Cleaning App enables to perform cleaning actions but not on all models.

I have started with Web-visitors cleaning by writing this ir-cron Task to delete records older than 15 days:

env['website.visitor'].search([('create_date','<',datetime.datetime.now()-datetime.timedelta(days=15))]).unlink()
  1. Have you such a way to clean old notifications (messages and mails) in odoo without triggering bugs or unexpected behaviors? (something better than MARK ALL AS READ as suggested here: https://www.odoo.com/fr_FR/forum/aide-1/bulk-clear-notifications-dismiss-all-conversations-as-read-173110). Is it safe to achieve it this way ?
env['mail.notification'].search([('notification_status','!=','ready'),('mail_message_id.date','<',datetime.datetime.now()-datetime.timedelta(days=360))]).unlink()
  1. How about the records of the 'mail.message'-model linked to the'mail.notification'-model via a Many2One field ?

  2. Do you know what other models could be cleaned in odoo to keep DB as light as possibe ?


enter image description here

Upvotes: 0

Views: 76

Answers (0)

Related Questions