From 7a235c19ff616787906501e168d93075c4fe70b0 Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Wed, 24 Mar 2021 15:55:01 +0000 Subject: [PATCH] [IMP] core: Deprecate cr.autocommit(True) Since Odoo 13.0 and the refactor of the internal synchronisation between the cache and the database, it is unsafe to use the ORM with the cursor in autocommit mode. The function is deprecated for removal in the future. closes odoo/odoo#68313 Task: 2442905 Signed-off-by: Raphael Collet (rco) --- odoo/sql_db.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/odoo/sql_db.py b/odoo/sql_db.py index 92aa9bcf56a..5c1536c087f 100644 --- a/odoo/sql_db.py +++ b/odoo/sql_db.py @@ -398,6 +398,11 @@ class Cursor(BaseCursor): @check def autocommit(self, on): if on: + warnings.warn( + "Since Odoo 13.0, the ORM delays UPDATE queries for " + "performance reasons. Since then, using the ORM with " + " autocommit(True) is unsafe, as computed fields may not be " + "fully computed at commit.", DeprecationWarning, stacklevel=2) isolation_level = ISOLATION_LEVEL_AUTOCOMMIT else: # If a serializable cursor was requested, we