social/mail_history/models/mail_notification.py

15 lines
372 B
Python

# Copyright 2020 Tecnativa - Carlos Roca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
class Notification(models.Model):
_inherit = 'mail.notification'
def unlink(self):
if self.env.context.get('unlink_is_read'):
self.write({"is_read": True})
else:
return super().unlink()