From a7f2056b150239cebe9490ea488814c365c64787 Mon Sep 17 00:00:00 2001 From: "Chong Wang (cwg)" Date: Thu, 30 Nov 2023 13:32:34 +0100 Subject: [PATCH] [FIX] core: KeyError odoo.fields in compute_value `field_computed` is decorated with `lazy_property` and will be reset by `setup_models` If a request comes, read `field_compute` when `setup_models` just clears some fields. The `field_compute` will be cached with fewer fields and cause KeyError for the registry in the future. This commit re-clear lazy_property for registry after fields are modified X-original-commit: 04e35d7bf3ca98dc722795c75033747697d70d30 Part-of: odoo/odoo#146544 --- odoo/modules/registry.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/odoo/modules/registry.py b/odoo/modules/registry.py index 620496045e4..09fcef82488 100644 --- a/odoo/modules/registry.py +++ b/odoo/modules/registry.py @@ -333,6 +333,9 @@ class Registry(Mapping): self.field_depends[field] = tuple(depends) self.field_depends_context[field] = tuple(depends_context) + # clean the lazy_property again in case they are cached by another ongoing registry readonly request + lazy_property.reset_all(self) + # Reinstall registry hooks. Because of the condition, this only happens # on a fully loaded registry, and not on a registry being loaded. if self.ready: