c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #32894
[Bug 857105] Re: bug in __leaf_to_sql (params is unassigned in certain cases))
*** This bug is a duplicate of bug 857069 ***
https://bugs.launchpad.net/bugs/857069
The fix has landed in trunk at revision revno: 3644 (revision-id:
vmt@xxxxxxxxxxx-20110923101839-ko0s7ekt4dlyvrx2).
Actually your domain involves a create_date column that (probably)
exists in database but not in the _columns of your model. I would either
consider your domain to be invalid, or a good idea that the ORM always
add those columns in _columns.
The fix allows again this situation to occur, but we will try to change
it (probably by always adding those into _columns) in the future.
Thanks a lot for the bug report.
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to OpenERP Project Group.
https://bugs.launchpad.net/bugs/857105
Title:
bug in __leaf_to_sql (params is unassigned in certain cases))
Status in OpenERP Server:
New
Bug description:
Hi guys!
I try to search records based on the date of creation. I do something
like:
self.search(cr, uid, [('create_date','<',before)], context=context)
I get an error:
File "/home/fde/repository/openobject-addons_trunk/mymodule/myfile.py", line 107, in cleanup
ids = self.search(cr, uid, [('create_date','<',before)], context=context)
File "/home/fde/repository/openobject-server_trunk/openerp/osv/orm.py", line 2112, in search
return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
File "/home/fde/repository/openobject-server_trunk/openerp/osv/orm.py", line 4570, in _search
query = self._where_calc(cr, user, args, context=context)
File "/home/fde/repository/openobject-server_trunk/openerp/osv/orm.py", line 4425, in _where_calc
where_clause, where_params = e.to_sql()
File "/home/fde/repository/openobject-server_trunk/openerp/osv/expression.py", line 786, in to_sql
q, p = self.__leaf_to_sql(e, table)
File "/home/fde/repository/openobject-server_trunk/openerp/osv/expression.py", line 774, in __leaf_to_sql
if isinstance(params, basestring):
UnboundLocalError: local variable 'params' referenced before assignment
> /home/fde/repository/openobject-server_trunk/openerp/osv/expression.py(774)__leaf_to_sql()
-> if isinstance(params, basestring):
However, the query is OK:
(Pdb) query
'(mymodule_myobject."create_date" < \'2011-09-23 06:27:47.722927\')'
It seems the error was introduced by Olivier Dony in revision 3642.
Params should just be assigned to [] before everything.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/857105/+subscriptions
References