[IMP] mail: gc more notification.

This gc option should delete more notifications: we only keep notification
not send, and set inbox notification as sent.

closes odoo/odoo#30067

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>


Co-authored-by: Thibault Delavallée <tde@odoo.com>
This commit is contained in:
Xavier-Do
2019-08-05 16:13:54 +00:00
co-authored by Thibault Delavallée
parent a55c78836f
commit 4f44ad4fe4
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -79,6 +79,6 @@ class Notification(models.Model):
('is_read', '=', True),
('read_date', '<', fields.Datetime.now() - relativedelta(days=max_age_days)),
('res_partner_id.partner_share', '=', False),
('notification_type', '=', 'email')
('notification_status', 'in', ('sent', 'canceled'))
]
return self.search(domain).unlink()
+1 -1
View File
@@ -1324,7 +1324,6 @@ class MailThread(models.AbstractModel):
:return: A dict with the following structure, where each
field may not be present if missing in original
message::
{ 'message_id': msg_id,
'subject': subject,
'from': from,
@@ -2009,6 +2008,7 @@ class MailThread(models.AbstractModel):
'mail_message_id': message.id,
'res_partner_id': pid,
'notification_type': 'inbox',
'notification_status': 'sent',
} for pid in inbox_pids]
self.env['mail.notification'].sudo().create(notif_create_values)