From 681d7832341c4b39fb331455bf4fd53be9746cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 29 Nov 2012 17:50:32 +0100 Subject: [PATCH] [IMP] expression.parse: added some asserts about non supported cases. bzr revid: tde@openerp.com-20121129165032-nnlnf1k0iwal24ny --- openerp/osv/expression.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openerp/osv/expression.py b/openerp/osv/expression.py index 5fb18fb8cc1..b13586f5311 100644 --- a/openerp/osv/expression.py +++ b/openerp/osv/expression.py @@ -561,8 +561,8 @@ class expression(object): alias = working_table._table while len(field_path) > 1 and field._auto_join: - if not field._type in ['many2one', 'one2many']: - raise '_auto_join attribute on something else than a many2one or one2many is currently not implemented... crashing' + assert field._type in ['many2one', 'one2many'], \ + '_auto_join attribute on something else than a many2one or one2many is currently not supported' previous_alias = alias alias = alias + '__' + field_path[0] @@ -625,6 +625,8 @@ class expression(object): if _logger.isEnabledFor(logging.DEBUG): _logger.debug(''.join(traceback.format_stack())) else: + assert working_table == table, \ + 'function fields can not be contained in paths using _auto_join' subexp = field.search(cr, uid, table, left, [self.exp[i]], context=context) if not subexp: self.exp[i] = TRUE_LEAF