[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.
This commit is contained in:
Raphael Collet
2020-11-24 13:23:32 +00:00
parent 7f2e168c02
commit a40511cd29
+1
View File
@@ -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()