[IMP] expression.py: add a check to forbid records in domains

Records in domains cause a "maximum recursion depth exceeded" error when
converted to SQL. Simply add a test to show a better error message.
This commit is contained in:
Raphael Collet 2014-10-15 12:29:33 +02:00
parent 342f7492c7
commit e9587bf130
2 changed files with 3 additions and 1 deletions

View File

@ -957,7 +957,7 @@ class crm_lead(format_address, osv.osv):
lead = self.browse(cr, uid, id, context=context)
local_context = dict(context)
local_context.setdefault('default_type', lead.type)
local_context.setdefault('default_section_id', lead.section_id)
local_context.setdefault('default_section_id', lead.section_id.id)
if lead.type == 'opportunity':
default['date_open'] = fields.datetime.now()
else:

View File

@ -1108,6 +1108,8 @@ class expression(object):
"Invalid operator %r in domain term %r" % (operator, leaf)
assert leaf in (TRUE_LEAF, FALSE_LEAF) or left in model._all_columns \
or left in MAGIC_COLUMNS, "Invalid field %r in domain term %r" % (left, leaf)
assert not isinstance(right, BaseModel), \
"Invalid value %r in domain term %r" % (right, leaf)
table_alias = '"%s"' % (eleaf.generate_alias())