project duplication gives error : ProgrammingError: syntax error at or near

Bug #599402 reported by Niels Huylebroeck on 2010-06-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
Unassigned

Bug Description

Tested on version 5.0.11

Create project, set it as Template, duplicate it. There is no visible error, no duplicated object.

Only error on server console :

Environment Information :
System : Linux-2.6.24-28-generic-x86_64-with-debian-lenny-sid
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu 8.04.4 LTS
Release: 8.04
Codename: hardy
Operating System Release : 2.6.24-28-generic
Operating System Version : #1 SMP Wed May 26 23:34:09 UTC 2010
Operating System Architecture : 64bit
Operating System Locale : en_US.UTF8
Python Version : 2.5.2
OpenERP-Server Version : 5.0.11
Last revision No. & ID : 2 serveradmin@openerp-20100628124902-7jrb2x5p0bkn82qb

Traceback (most recent call last):
  File "/home/red15/Documents/Werk/OpenERP/elka/openerp-server/osv/osv.py", line 58, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/red15/Documents/Werk/OpenERP/elka/openerp-server/osv/osv.py", line 119, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/red15/Documents/Werk/OpenERP/elka/openerp-server/osv/osv.py", line 111, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/red15/Documents/Werk/OpenERP/elka/openerp-server/addons/project/project.py", line 170, in copy
    cr.execute('update project_task set active=True where project_id in %s', (tuple(ids,)))
  File "/home/red15/Documents/Werk/OpenERP/elka/openerp-server/sql_db.py", line 77, in wrapper
    return f(self, *args, **kwargs)
  File "/home/red15/Documents/Werk/OpenERP/elka/openerp-server/sql_db.py", line 122, in execute
    res = self._obj.execute(query, params)
ProgrammingError: syntax error at or near "6"
LINE 1: update project_task set active=True where project_id in 6

Looks like the offending code is this piece :

        cr.execute('update project_task set active=True where project_id in %s', (tuple(ids,)))

Does this have any version limitations ?
Just to be sure I'm running
Postgresql 8.3
Psycopg 2.0.6

Some slight dabbling in array expansion for psycopg lead me to this code :

cr.execute(" select id from account_account where id in %(account)s", {'account': [1,2,3]})

Yields following :
"select from account_account where id in ARRAY[1,2,3]"

Related branches

Changed in openobject-addons:
status: New → Confirmed

It has been fixed by revision 2766 <email address hidden>.
Thanks for letting us know.

Changed in openobject-addons:
importance: Undecided → Medium
milestone: none → 5.0.10
status: Confirmed → Fix Committed
status: Fix Committed → Fix Released
milestone: 5.0.10 → 5.0.12
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers