[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:
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user