From 4f44ad4fe4e670eedb357bf5c04972c597fa3d5b Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Mon, 5 Aug 2019 11:20:57 +0000 Subject: [PATCH] [IMP] mail: gc more notification. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Co-authored-by: Thibault Delavallée --- addons/mail/models/mail_notification.py | 2 +- addons/mail/models/mail_thread.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/mail_notification.py b/addons/mail/models/mail_notification.py index e47f337e491..a45a7223b5f 100644 --- a/addons/mail/models/mail_notification.py +++ b/addons/mail/models/mail_notification.py @@ -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() diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 27357c8d8cb..28753cf4dd1 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -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)