From ef26faf0a52ff74a6c58f60719bc9cb2a59114e5 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 2 Aug 2012 17:25:53 +0200 Subject: [PATCH] [IMP] add more information when searching on a non-searchable field using debug logging bzr revid: xmo@openerp.com-20120802152553-r8xpw0g6bep08jod --- openerp/osv/expression.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openerp/osv/expression.py b/openerp/osv/expression.py index 8db87a61e5e..e2a3391c8a4 100644 --- a/openerp/osv/expression.py +++ b/openerp/osv/expression.py @@ -122,6 +122,7 @@ start the server specifying the --unaccent flag. """ import logging +import traceback from openerp.tools import flatten, reverse_enumerate import fields @@ -426,6 +427,7 @@ class expression(object): # If the field is _inherits'd, search for the working_table, # and extract the field. + field = None if field_path[0] in table._inherit_fields: while True: field = working_table._columns.get(field_path[0]) @@ -475,9 +477,12 @@ class expression(object): # values in the database, so we must ignore it : we generate a dummy leaf self.__exp[i] = TRUE_LEAF _logger.error( - "The field '%s' can not be searched: non-stored " + "The field '%s' (%s) can not be searched: non-stored " "function field without fnct_search", - field.string) + field.string, left) + # avoid compiling stack trace if not needed + if _logger.isEnabledFor(logging.DEBUG): + _logger.debug(''.join(traceback.format_stack())) else: subexp = field.search(cr, uid, table, left, [self.__exp[i]], context=context) if not subexp: