summaryrefslogtreecommitdiff
path: root/addons/google_calendar/models/google_sync.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2020-09-03 09:17:26 +0000
committerRaphael Collet <rco@odoo.com>2020-09-03 09:17:26 +0000
commite9e37091a65d5ae2caa9eb6728abaffb7c9555a8 (patch)
treea9045da0be927e8608afee70b58118f2ebcdd97b /addons/google_calendar/models/google_sync.py
parentd4b2e9224839aed8fc160ebe5a89e0f7d4c6a5bb (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/google_calendar/models/google_sync.py')
-rw-r--r--addons/google_calendar/models/google_sync.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/google_calendar/models/google_sync.py b/addons/google_calendar/models/google_sync.py
index 9957bdad6cc..f29302ce1f7 100644
--- a/addons/google_calendar/models/google_sync.py
+++ b/addons/google_calendar/models/google_sync.py
@@ -30,6 +30,8 @@ def after_commit(func):
dbname = self.env.cr.dbname
context = self.env.context
uid = self.env.uid
+
+ @self.env.cr.postcommit.add
def called_after():
db_registry = registry(dbname)
with api.Environment.manage(), db_registry.cursor() as cr:
@@ -39,7 +41,7 @@ def after_commit(func):
except Exception as e:
_logger.warning("Could not sync record now: %s" % self)
_logger.exception(e)
- self.env.cr.after('commit', called_after)
+
return wrapped
@contextmanager