[FIX] mail: allow sending notification emails

Add back the 'sudo()' on batch mail unlinking.

Sudo is necessary to delete user notifications on auto-delete.
Which makes sense as the  recipient would have an email for it anyway.

The sudo was there as far back as:
c5c369355d

Then transfered in this change:
036a739b62

And removed in the recent optimization here:
e38bfd25df1bb25e7e5695b536052d5a0c85c5c4

task-3225207

closes odoo/odoo#115956

X-original-commit: 93a28f17024511e30d3c70eb847c361ca87e0ffe
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Thiry Renaud (reth) <reth@odoo.com>
This commit is contained in:
Renaud Thiry
2023-03-21 07:36:00 +01:00
parent 86ffeb2e5d
commit bc4abcc1b3
+1 -1
View File
@@ -262,7 +262,7 @@ class MailMail(models.Model):
# TDE TODO: could be great to notify message-based, not notifications-based, to lessen number of notifs
messages._notify_message_notification_update() # notify user that we have a failure
if not failure_type or failure_type in ['mail_email_invalid', 'mail_email_missing']: # if we have another error, we want to keep the mail.
self.filtered(lambda mail: mail.auto_delete).unlink()
self.sudo().filtered(lambda mail: mail.auto_delete).unlink()
return True