[FIX] mail: unlink only sent emails, not failed emails.
authorThibault Delavallée <tde@openerp.com>
Fri, 25 Apr 2014 12:27:26 +0000 (14:27 +0200)
committerThibault Delavallée <tde@openerp.com>
Fri, 25 Apr 2014 12:27:26 +0000 (14:27 +0200)
bzr revid: tde@openerp.com-20140425122726-k5upt8tq5xp4m228

addons/mail/mail_mail.py

index 12903d0..a32d82e 100644 (file)
@@ -135,7 +135,7 @@ class mail_mail(osv.Model):
         :param browse_record mail: the mail that was just sent
         :return: True
         """
-        if mail.auto_delete:
+        if mail_sent and mail.auto_delete:
             # done with SUPERUSER_ID to avoid giving large unlink access rights
             self.unlink(cr, SUPERUSER_ID, [mail.id], context=context)
         return True