[FIX] mail: disable prefetching on send mail

Minimal backport of 00bd7274
Processing large mails may reach the memory limit and crash the mail queue.

Such scenario was found at opw-724697
This commit is contained in:
Martin Trigaux
2017-03-21 16:48:31 +01:00
parent b957fa76b7
commit f1d004b996
+2 -1
View File
@@ -208,8 +208,9 @@ class MailMail(models.Model):
"""
IrMailServer = self.env['ir.mail_server']
for mail in self:
for mail_id in self.ids:
try:
mail = self.browse(mail_id)
# TDE note: remove me when model_id field is present on mail.message - done here to avoid doing it multiple times in the sub method
if mail.model:
model = self.env['ir.model'].sudo().search([('model', '=', mail.model)])[0]