[IMP] core: deprecate method cr.after()

Use the more convenient `cr.postcommit.add()` instead.

closes odoo/odoo#57043

X-original-commit: e9e37091a65d5ae2caa9eb6728abaffb7c9555a8
Related: odoo/enterprise#12928
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This commit is contained in:
Raphael Collet
2020-09-03 14:29:39 +00:00
parent e8f7cfd00a
commit 317765c8f3
6 changed files with 16 additions and 5 deletions
+5
View File
@@ -14,6 +14,7 @@ import itertools
import logging
import time
import uuid
import warnings
from decorator import decorator
import psycopg2
@@ -420,6 +421,10 @@ class Cursor(BaseCursor):
back or committed independently. You may consider the use of a
dedicated temporary cursor to do some database operation.
"""
warnings.warn(
"Cursor.after() is deprecated, use Cursor.postcommit.add() instead.",
DeprecationWarning,
)
if event == 'commit':
self.postcommit.add(func)
elif event == 'rollback':