c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #12597
Re: [Bug 703105] [NEW] [6.0RC2] orm groupby doesn't add tablenames to fields and groupby clause
On Saturday 15 January 2011, you wrote:
> Public bug reported:
>
> orm.py, class orm function readgroup line 2167
>
> There are no tablenames added to the fieldname, leading to the following
> error when grouping projects by parent
> ProgrammingError: column reference "parent_id" is ambiguous
> LINE 1: ... id, count(project_project.id) AS parent_id_count,parent_id,...
> ^
You are right that the 'group_by' feature should indicate table names.
However, note that project.parent_id has been removed a few commits ago, so
that model won't have a column conflict with its 'account.analytic.account'
base model.
--
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/703105
Title:
[6.0RC2] orm groupby doesn't add tablenames to fields and groupby
clause
Status in OpenObject Server:
New
Bug description:
orm.py, class orm function readgroup line 2167
There are no tablenames added to the fieldname, leading to the
following error when grouping projects by parent
1. Create some analytic accounts with parent/childs
2. Create some projects with parent/childs
3. Try a grouped view by parent.
Environment Information :
System : Linux-2.6.35-22-generic-i686-with-Ubuntu-10.04-lucid
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu 10.04.1 LTS
Release: 10.04
Codename: lucid
Operating System Release : 2.6.35-22-generic
Operating System Version : #34~lucid1-Ubuntu SMP Mon Oct 11 14:36:18 UTC 2010
Operating System Architecture : 32bit
Operating System Locale : nl_BE.UTF8
Python Version : 2.6.5
OpenERP-Client Version : 6.0.0-rc2
Last revision No. & ID :0 null:
Traceback (most recent call last):
File "/home/ruben/workspace/openerp/trunk/server/bin/netsvc.py", line 489, in dispatch
result = ExportService.getService(service_name).dispatch(method, auth, params)
File "/home/ruben/workspace/openerp/trunk/server/bin/service/web_services.py", line 599, in dispatch
res = fn(db, uid, *params)
File "/home/ruben/workspace/openerp/trunk/server/bin/osv/osv.py", line 122, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/ruben/workspace/openerp/trunk/server/bin/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/ruben/workspace/openerp/trunk/server/bin/osv/osv.py", line 167, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/ruben/workspace/openerp/trunk/server/bin/osv/orm.py", line 2182, in read_group
cr.execute('SELECT min(%s.id) AS id, count(%s.id) AS %s_count' % (self._table, self._table, group_count) + (flist and ',') + flist + ' FROM ' + from_clause + where_clause + gb + limit_str + offset_str, where_clause_params)
File "/home/ruben/workspace/openerp/trunk/server/bin/sql_db.py", line 76, in wrapper
return f(self, *args, **kwargs)
File "/home/ruben/workspace/openerp/trunk/server/bin/sql_db.py", line 129, in execute
res = self._obj.execute(query, params)
ProgrammingError: column reference "parent_id" is ambiguous
LINE 1: ... id, count(project_project.id) AS parent_id_count,parent_id,...
^
Solution my be to force the tablename to be joined to the fieldname.
Regards,
Ruben
References