c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #12233
[Bug 701013] Re: [v6rc2] orm read() bug on redefined fields
Hello fc,
Your analysis and patch are perfectly correct! Indeed, read_flat() has a
step to post-process special fields, like many2one, who are not directly
returned as stored in the database. This post-processing step is not
meant to be re-entrant, so when the field is requested twice, it can
break in various ways. And as you noticed, when an osv object redefines
one of its parent's column, read() did not remove the duplicates field
names, when a read() call is issued without the list of fields to read.
This is fixed as of revision 3255
(odo@xxxxxxxxxxx-20110113010901-ckzrapjkt2uoh9r5) of the server, and in
addition to your suggested patch we also strengthened the underlying
m2o.get, to cover other similar cases.
Many thanks!
** Changed in: openobject-server
Status: Confirmed => Fix Released
** Changed in: openobject-server
Milestone: None => 6.0
** Summary changed:
- [v6rc2] orm read() bug on redefined fields
+ [v6rc2] orm read() fails when no fields-list pass on objects that override parent columns
** Summary changed:
- [v6rc2] orm read() fails when no fields-list pass on objects that override parent columns
+ [v6rc2] orm read() fails when no fields-list passed, on objects that override parent columns
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/701013
Title:
[v6rc2] orm read() fails when no fields-list passed, on objects that
override parent columns
Status in OpenObject Server:
Fix Released
Bug description:
Hello,
The "project" module has been modified since rc1, among other things,
the field "parent_id" is now a "project.project" and doing a XMLRPC
read on a project having this field set now leads to a server error,
as described below.
Steps to reproduce:
* install v6rc2 with the project module
* create two projects "foo" (id 1) and "bar" (id 2) having "foo" as parent
* execute(1,"read") => succeeds
* execute(2,"read","parent_id") => succeeds
* execute(2,"read") => FAILS with the following error:
---
[2011-01-10 14:03:12,035][main] ERROR:db.cursor:Programming error: arguments of row IN must all be row expressions
LINE 1: ...d FROM "project_project" WHERE project_project.id IN ((1, E'...
^
, in query SELECT project_project.analytic_account_id,project_project.id FROM "project_project" WHERE project_project.id IN %s ORDER BY sequence
[2011-01-10 14:03:12,036][main] ERROR:web-services:Uncaught exception
Traceback (most recent call last):
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/osv/osv.py", line 122, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/osv/osv.py", line 177, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/osv/osv.py", line 167, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/osv/orm.py", line 2920, in read
result = self._read_flat(cr, user, select, fields, context, load,indent+" ")
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/osv/orm.py", line 3058, in _read_flat
res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res,indent=indent+" ")
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/osv/fields.py", line 362, in get
records = dict(obj.name_get(cr, 1, list(set(filter(None, res.values()))), context=context,indent=indent))
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/osv/orm.py", line 1766, in name_get
[self._rec_name], context, load='_classic_write',indent=indent)]
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/osv/orm.py", line 2920, in read
result = self._read_flat(cr, user, select, fields, context, load,indent+" ")
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/osv/orm.py", line 2984, in _read_flat
cr.execute(query, (tuple(sub_ids),))
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/sql_db.py", line 76, in wrapper
return f(self, *args, **kwargs)
File "/home/user/Documents/openerp-server-6.0.0-rc2/bin/sql_db.py", line 129, in execute
res = self._obj.execute(query, params)
ProgrammingError: arguments of row IN must all be row expressions
LINE 1: ...d FROM "project_project" WHERE project_project.id IN ((1, E'...
^
[2011-01-10 14:03:12,039][main] DEBUG_RPC:exception:u'arguments of row IN must all be row expressions\nLINE 1: ...d FROM "project_project" WHERE project_project.id IN ((1, E\'...\n ^\n'
[2011-01-10 14:03:12,040][main] DEBUG_RPC:xmlrpc:"POST /object HTTP/1.0" 200 -
---
As it occurs in sql_db.py, it is not specific to the project module as
far as I understand the issue.
Adding some trace in orm.py:_flat_read() show the query to be:
SELECT project_project.analytic_account_id,project_project.id FROM "project_project" WHERE project_project.id IN %s ORDER BY sequence
with args= ((1, u'foo'),), where a list of ints is expected.
Somehow there's no impact on the user interface (so far), I guess the
client doesn't use a full read() but read each field separately.
References