summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier-Do <xdo@odoo.com>2019-08-05 11:20:57 +0000
committerXavier-Do <xdo@odoo.com>2019-08-05 16:13:54 +0000
commit4f44ad4fe4e670eedb357bf5c04972c597fa3d5b (patch)
tree57c1a2313c0bc9d80a8e61430cb0a5db5f977816
parenta55c78836f172dba1cfa6db3df0e927a9c7e6471 (diff)
[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>
-rw-r--r--addons/mail/models/mail_notification.py2
-rw-r--r--addons/mail/models/mail_thread.py2
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)