From f2da2d6811f63a8e6aacbf7fc6a0da496fd78001 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 27 Nov 2013 16:25:37 +0100 Subject: [PATCH] [FIX] orm: browse() do not prefetch deprecated fields bzr revid: chs@openerp.com-20131127152537-wkof87ut5cdud6z6 --- openerp/osv/orm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 517f5126f54..71053a02cae 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -383,10 +383,12 @@ class browse_record(object): self.__logger.debug(''.join(traceback.format_stack())) raise KeyError(error_msg) + prefetchable = lambda f: f._classic_write and f._prefetch and not f.groups and not f.deprecated + # if the field is a classic one or a many2one, we'll fetch all classic and many2one fields - if col._prefetch and not col.groups: + if prefetchable(col): # gen the list of "local" (ie not inherited) fields which are classic or many2one - field_filter = lambda x: x[1]._classic_write and x[1]._prefetch and not x[1].groups + field_filter = lambda x: prefetchable(x[1]) fields_to_fetch = filter(field_filter, self._table._columns.items()) # gen the list of inherited fields inherits = map(lambda x: (x[0], x[1][2]), self._table._inherit_fields.items())