From a40511cd29d0ded5f104edf3ad3f41dbf6ea2a29 Mon Sep 17 00:00:00 2001 From: Raphael Collet <rco@odoo.com> Date: Wed, 11 Nov 2020 15:16:25 +0000 Subject: [PATCH] [FIX] core: env.clear() also invalidates lazy properties In unit tests, this avoids side effects from one test to another. In particular, a test modifying the user's company can make other tests fail because `env.company` defaults to the user's company when nothing else is available in the context. --- odoo/api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/odoo/api.py b/odoo/api.py index bace379051bb..38e9234946ef 100644 --- a/odoo/api.py +++ b/odoo/api.py @@ -613,6 +613,7 @@ class Environment(Mapping): """ Clear all record caches, and discard all fields to recompute. This may be useful when recovering from a failed ORM operation. """ + lazy_property.reset_all(self) self.cache.invalidate() self.all.tocompute.clear() self.all.towrite.clear() -- GitLab