From 8f600f8a4b60bb5f60a897691061862ebd78781b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Voet=20=28ryv=29?= Date: Fri, 19 May 2023 08:51:10 +0000 Subject: [PATCH] [REV] core: handle recursion error when resolving stored fields This reverts commit 9e71094582ec4c9b719431e77538da8f91ffa9e3. Why? - It is useless in 16.0, the bug it claims to fix should not exist. In the commit explanation the sentence 'this calls `_read`, which flushes the field we're trying to read' is wrong, since https://github.com/odoo/odoo/pull/66938 (merged in 15.5). (It is still true for fields that are in an ir.rule, but it sounds very unlikely to have a recursive field in ir.rule that causes trigger the problem) - It creates worst errors (infinite loop for recursive field computation on missing record - Next commit). - Also, it looks like a dangerous fix that can hide or trigger new issues. X-original-commit: 4a46c1049a4cdc15f0e211d228fb976ba7a0173d Part-of: odoo/odoo#122147 --- odoo/fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odoo/fields.py b/odoo/fields.py index b0ed5bf4316..f3e1a2e042b 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -1178,10 +1178,11 @@ class Field(MetaField('DummyField', (object,), {})): # not stored and not computed -> default # if self.store and record.id: + # real record: fetch from database recs = record._in_cache_without(self) try: recs._fetch_field(self) - except (AccessError, RecursionError): + except AccessError: if len(recs) == 1: raise record._fetch_field(self)