diff options
| author | len-odoo <len@odoo.com> | 2018-10-04 14:25:09 +0000 |
|---|---|---|
| committer | len-odoo <len@odoo.com> | 2018-10-05 08:47:49 +0000 |
| commit | a9ce28bfb1fe2bb3087d44e912ec2b39785ab76f (patch) | |
| tree | a2d9324ea4b75b2d2934fa0851657b1b9dfa3237 /addons/mail/models/mail_thread.py | |
| parent | 360212f2064e8bd72a3689f1e0104bfb73521f2a (diff) | |
[FIX] mail, mass_mailing: remove implicit dependency on mass_mailing
Fix to commit: a1d6064dcc6d349c02556453e1aa052e60db41c0
Which erroneously put a mass_mailing method in mail,
as mail.mail.statistics is defined in mass_mailing.
Since it does not depend on the records, it been extracted from the
loop.
opw 1890461
closes odoo/odoo#27431
Diffstat (limited to 'addons/mail/models/mail_thread.py')
| -rw-r--r-- | addons/mail/models/mail_thread.py | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 193bd305e8f..f6e31c9f32c 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -32,7 +32,6 @@ from odoo.tools.safe_eval import safe_eval _logger = logging.getLogger(__name__) -BLACKLIST_MAX_BOUNCED_LIMIT = 5 class MailThread(models.AbstractModel): @@ -1471,14 +1470,6 @@ class MailThread(models.AbstractModel): Mail Returned to Sender) is received for an existing thread. The default behavior is to check is an integer ``message_bounce`` column exists. If it is the case, its content is incremented. - In addition, an auto blacklist rule check if the email can be blacklisted - to avoid sending mails indefinitely to this email address. - This rule checks if the email bounced too much. If this is the case, - the email address is added to the blacklist in order to avoid continuing - to send mass_mail to that email address. If it bounced too much times - in the last month and the bounced are at least separated by one week, - to avoid blacklist someone because of a temporary mail server error, - then the email is considered as invalid and is blacklisted. :param mail_id: ID of the sent email that bounced. It may not exist anymore but it could be usefull if the information was kept. This is @@ -1488,14 +1479,6 @@ class MailThread(models.AbstractModel): if 'message_bounce' in self._fields: for record in self: record.message_bounce = record.message_bounce + 1 - three_months_ago = fields.Datetime.to_string(datetime.datetime.now() - datetime.timedelta(weeks=13)) - stats = self.env['mail.mail.statistics']\ - .search(['&', ('bounced', '>', three_months_ago), ('email','=ilike',email)])\ - .mapped('bounced') - if len(stats) >= BLACKLIST_MAX_BOUNCED_LIMIT: - if max(stats) > min(stats) + datetime.timedelta(weeks=1): - blacklist_rec = self.env['mail.blacklist'].sudo()._add(email) - blacklist_rec._message_log('This email has been automatically blacklisted because of too much bounced.') def _message_extract_payload_postprocess(self, message, body, attachments): """ Perform some cleaning / postprocess in the body and attachments |
