diff options
| author | Dave Lasley <dave@laslabs.com> | 2017-08-28 09:13:54 -0700 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2017-11-08 15:30:59 +0100 |
| commit | aa3834b9fac30875f498c5d09b7c03a020bbe372 (patch) | |
| tree | 991383c34bc23c42f0ffa6e6355c757e7e80fc29 /odoo/tools/cache.py | |
| parent | 2d3e6d7383aaa3c1589f220ab3a97c715d73e00a (diff) | |
[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
Diffstat (limited to 'odoo/tools/cache.py')
| -rw-r--r-- | odoo/tools/cache.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/odoo/tools/cache.py b/odoo/tools/cache.py index b6b23175773..a4f49831d6c 100644 --- a/odoo/tools/cache.py +++ b/odoo/tools/cache.py @@ -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 |
