[MERGE] forward port branch saas-15 up to cd28e53a31

This commit is contained in:
Christophe Simonis
2019-04-08 16:46:31 +02:00
2 changed files with 11 additions and 1 deletions
@@ -62,7 +62,8 @@ class MailComposeMessage(models.TransientModel):
if mail_values.get('email_to'):
recips = tools.email_split(mail_values['email_to'])
else:
recips = tools.email_split(partners_email.get(res_id))
partner_id = (mail_values.get('recipient_ids') or [(False, '')])[0][1]
recips = tools.email_split(partners_email.get(partner_id))
mail_to = recips[0].lower() if recips else False
if (blacklist and mail_to in blacklist) or (seen_list and mail_to in seen_list):
# prevent sending to blocked addresses that were included by mistake
+9
View File
@@ -21,6 +21,7 @@ from docutils.core import publish_string
from docutils.transforms import Transform, writer_aux
from docutils.writers.html4css1 import Writer
import lxml.html
import psycopg2
import odoo
from odoo import api, fields, models, modules, tools, _
@@ -536,6 +537,14 @@ class Module(models.Model):
@api.multi
def _button_immediate_function(self, function):
try:
# This is done because the installation/uninstallation/upgrade can modify a currently
# running cron job and prevent it from finishing, and since the ir_cron table is locked
# during execution, the lock won't be released until timeout.
self._cr.execute("SELECT * FROM ir_cron FOR UPDATE NOWAIT")
except psycopg2.OperationalError:
raise UserError(_("The server is busy right now, module operations are not possible at"
" this time, please try again later."))
function(self)
self._cr.commit()