[FIX] mail: manage Environment before using it

This is needed for crons that happen to send notifications. Without it,
the email sending was delayed until the `process email queue` cron run.
This commit is contained in:
Christophe Simonis
2017-02-15 14:50:58 +01:00
parent 85fe21f19b
commit d88b95969c
+1 -1
View File
@@ -237,7 +237,7 @@ class Partner(models.Model):
def send_notifications():
db_registry = registry(dbname)
with db_registry.cursor() as cr:
with api.Environment.manage(), db_registry.cursor() as cr:
env = api.Environment(cr, SUPERUSER_ID, {})
env['mail.mail'].browse(email_ids).send()