diff options
| author | Raphael Collet <rco@odoo.com> | 2020-09-03 09:17:26 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2020-09-03 09:17:26 +0000 |
| commit | e9e37091a65d5ae2caa9eb6728abaffb7c9555a8 (patch) | |
| tree | a9045da0be927e8608afee70b58118f2ebcdd97b /addons/mail/models/mail_thread.py | |
| parent | d4b2e9224839aed8fc160ebe5a89e0f7d4c6a5bb (diff) | |
[IMP] core: deprecate method cr.after()
Use the more convenient `cr.postcommit.add()` instead.
closes odoo/odoo#56990
Related: odoo/enterprise#12914
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'addons/mail/models/mail_thread.py')
| -rw-r--r-- | addons/mail/models/mail_thread.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 802fef140ae..caff059b408 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -2307,12 +2307,13 @@ class MailThread(models.AbstractModel): email_ids = emails.ids dbname = self.env.cr.dbname _context = self._context + + @self.env.cr.postcommit.add def send_notifications(): db_registry = registry(dbname) with api.Environment.manage(), db_registry.cursor() as cr: env = api.Environment(cr, SUPERUSER_ID, _context) env['mail.mail'].browse(email_ids).send() - self._cr.after('commit', send_notifications) else: emails.send() |
