Hey Cyllo users, best way to handle `@api.autovacuum`? Should I use a cron job, or is there a better approach within Cyllo itself?
Welcome!
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.
This question has been flagged
Here's how you can use the `@api.autovacuum` decorator to schedule a cleanup task. This will integrate your cleanup method into Odoo's automated vacuum process. The '@api.autovacuum' method decorator allows you to mark a method so that it runs as part of the daily vacuum cron job (model 'ir.autovacuum'). This is useful for tasks similar to garbage collection, which help manage resources but don’t require a separate cron job. By using this decorator, you can ensure that necessary maintenance tasks are performed automatically on a regular basis without needing to set up individual cron jobs for each task. class SomeModel(models.Model): _name = 'your.model' @api.autovacuum def _cleanup_old_records(self): old_records = self.search([('create_date', '<', fields.Datetime.subtract(days=30))]) old_records.unlink()