[IMP] mail: trigger garbage collection of attachments from model ir.autovacuum
This commit is contained in:
@@ -28,19 +28,6 @@
|
||||
<field name="priority">1000</field>
|
||||
</record>
|
||||
|
||||
<record id="ir_cron_mail_garbage_collect_attachments" model="ir.cron">
|
||||
<field name="name">Garbage Collect Mail Attachments</field>
|
||||
<field eval="True" name="active" />
|
||||
<field name="user_id" ref="base.user_root" />
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">weeks</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall" />
|
||||
<field name="model">mail.thread</field>
|
||||
<field name="function">_garbage_collect_attachments</field>
|
||||
<field name="args">()</field>
|
||||
</record>
|
||||
|
||||
<!-- Admin should not receivve emails at creation -->
|
||||
<record id="base.partner_root" model="res.partner">
|
||||
<field name="notify_email">none</field>
|
||||
|
||||
@@ -15,4 +15,5 @@ import res_users
|
||||
import res_config
|
||||
import update
|
||||
import ir_actions
|
||||
import ir_autovacuum
|
||||
import html2text
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp import models
|
||||
|
||||
class AutoVacuum(models.TransientModel):
|
||||
_inherit = 'ir.autovacuum'
|
||||
|
||||
def power_on(self, cr, uid, *args, **kwargs):
|
||||
self.pool['mail.thread']._garbage_collect_attachments(cr, uid)
|
||||
return super(AutoVacuum, self).power_on(cr, uid, *args, **kwargs)
|
||||
Reference in New Issue
Block a user