[IMP] tools: Add note to ormcache regarding closed cursors

Returning a recordset from a cached method will raise an
`psycopg2.OperationalError` once the cursor is closed.

Add documentation to `ormcache` method indicating such
See OCA/stock-logistics-barcode#93 and #8795 for example of issues

Closes #19113
This commit is contained in:
Dave Lasley
2017-11-08 15:30:59 +01:00
committed by Martin Trigaux
parent 2d3e6d7383
commit aa3834b9fa
+4
View File
@@ -47,6 +47,10 @@ class ormcache(object):
@ormcache(skiparg=1)
def _compute_domain(self, model_name, mode="read"):
...
Methods implementing this decorator should never return a Recordset,
because the underlying cursor will eventually be closed and raise a
`psycopg2.OperationalError`.
"""
def __init__(self, *args, **kwargs):
self.args = args