Skip to content

Commit 2b3932a

Browse files
elre-odooaj-fuentes
authored andcommitted
[FIX] util/orm.py: Restore compatibility with 7.0
When the module `runsanitizer` is loaded, Odoo is trying to import `env()` from util/orm.py. There is a check to ensure that `openerp.fields`, which was introduced in 8.0, is not being read by earlier versions and set to None instead. While parsing orm.py however, all decorators are evaluated including `no_selection_cache_validation()`, which assumes that `openerp.fields` has been imported, and fails on an AttributeError. A check at the top of the decorator fixes that (it was already anticipated that the decorated function `recompute_fields` would not work in 7.0). Part-of: #7
1 parent 95e3cac commit 2b3932a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/util/orm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ def invalidate(records, *args):
196196

197197

198198
def no_selection_cache_validation(f=None):
199+
if not version_gte("8.0"):
200+
return f
199201
old_convert = ofields.Selection.convert_to_cache
200202

201203
def _convert(self, value, record, validate=True):

0 commit comments

Comments
 (0)