Error when computing sales order

Bug #643802 reported by stijnbe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Invalid
Undecided
Dhruti Shastri(OpenERP)

Bug Description

When I try to compute a new sales order, save the order or deposit a sales order I get this error:

Environment Information :
System : Linux-2.6.32-24-generic-x86_64-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.32-24-generic
Operating System Version : #43-Ubuntu SMP Thu Sep 16 14:58:24 UTC 2010
Operating System Architecture : 64bit
Operating System Locale : en_US.UTF8
Python Version : 2.6.5
OpenERP-Client Version : 6.0dev
Last revision No. & ID :1564 <email address hidden>
Traceback (most recent call last):
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/netsvc.py", line 439, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/service/web_services.py", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/osv/osv.py", line 57, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/osv/osv.py", line 140, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/osv/osv.py", line 130, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/stijnbe/Testing/openerp/openobject-addons/sale/sale.py", line 391, in create
    return super(sale_order, self).create(cr, uid, vals, context=context)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/osv/orm.py", line 3774, in create
    wf_service.trg_create(user, self._name, id_new, cr)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/workflow/wkf_service.py", line 72, in trg_create
    instance.create(cr, ident, wkf_id)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/workflow/instance.py", line 30, in create
    cr.execute('insert into wkf_instance (res_type,res_id,uid,wkf_id) values (%s,%s,%s,%s) RETURNING id', (res_type,res_id,uid,wkf_id))
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/sql_db.py", line 75, in wrapper
    return f(self, *args, **kwargs)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/sql_db.py", line 122, in execute
    res = self._obj.execute(query, params)
ProgrammingError: syntax error at or near "RETURNING"
LINE 1: ...e,res_id,uid,wkf_id) values (E'sale.order',4,1,5) RETURNING ...
                                                             ^
Version is latest trunk

stijnbe (stijnbe)
description: updated
Changed in openobject-addons:
assignee: nobody → DHS(OpenERP) (dhs-openerp)
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Stijn,

I don't confirm the error as I could not meet it at my end.
But as a probable workaround,I guess it comes due to locale settings.

May be, the attached patch will solve it at your end.
Let me know what are the steps you perform to get the error and notify us about the behavior after applying the patch.

Thanks.

Changed in openobject-addons:
milestone: none → 6.0
Revision history for this message
stijnbe (stijnbe) wrote :

I applied the patch and now I get a little different error (E is gone in query):

Environment Information :
System : Linux-2.6.32-24-generic-x86_64-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.32-24-generic
Operating System Version : #43-Ubuntu SMP Thu Sep 16 14:58:24 UTC 2010
Operating System Architecture : 64bit
Operating System Locale : en_US.UTF8
Python Version : 2.6.5
OpenERP-Client Version : 6.0dev
Last revision No. & ID :1564 <email address hidden>
Traceback (most recent call last):
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/netsvc.py", line 439, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/service/web_services.py", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/osv/osv.py", line 57, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/osv/osv.py", line 140, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/osv/osv.py", line 130, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/stijnbe/Testing/openerp/openobject-addons/sale/sale.py", line 391, in create
    return super(sale_order, self).create(cr, uid, vals, context=context)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/osv/orm.py", line 3774, in create
    wf_service.trg_create(user, self._name, id_new, cr)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/workflow/wkf_service.py", line 72, in trg_create
    instance.create(cr, ident, wkf_id)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/workflow/instance.py", line 30, in create
    cr.execute("insert into wkf_instance (res_type,res_id,uid,wkf_id) values ('%s',%s,%s,%s) RETURNING id" % (res_type,res_id,uid,wkf_id))
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/sql_db.py", line 75, in wrapper
    return f(self, *args, **kwargs)
  File "/home/stijnbe/Testing/openerp/openobject-server/bin/sql_db.py", line 122, in execute
    res = self._obj.execute(query, params)
ProgrammingError: syntax error at or near "RETURNING"
LINE 1: ...pe,res_id,uid,wkf_id) values ('sale.order',9,1,5) RETURNING ...
                                                             ^

Revision history for this message
stijnbe (stijnbe) wrote :

Looks like I have an old postgresql (8.1.*) version causing this problem. I installed postgresql from the centos repositories. RETURNING only exists since 8.2 .
Thanks for your help I will now try to upgrade my postgres.

Revision history for this message
stijnbe (stijnbe) wrote :

Using your patch and upgrading my postgresql to 8.4 solved the problem.

thanks

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Closing the bug as it does not occur with latest OpenERP and latest psql too.
Thanks Stijn.

Changed in openobject-addons:
status: New → Invalid
Revision history for this message
stijnbe (stijnbe) wrote :

Upgrading pgsql alone did not solve the problem I needed your patch. What could be wrong there?

Thanks

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

If it is so, I need to check with other locale too.
I will try it asap.
Thanks.

affects: openobject-addons → openobject-server
Changed in openobject-server:
milestone: 6.0 → none
status: Invalid → New
Revision history for this message
Dhruti Shastri(OpenERP) (dhs-openerp) wrote :

Hello Stijn,

I tried with (Operating System) Locale : en_US.UTF8, but no error found at my end.(PostgreSQL 8.4.4)

Are you sure that you really needed to apply the patch?

Let me inform if you are getting still error without applying patch.

Thanks.

Revision history for this message
stijnbe (stijnbe) wrote :

I still get this error without patch:
db.cursor:Programming error: syntax error at or near "sale"
LINE 1: ..._instance (res_type,res_id,uid,wkf_id) values ('E'sale.order...
                                                             ^
, in query insert into wkf_instance (res_type,res_id,uid,wkf_id) values ('%s',%s,%s,%s) RETURNING id

Revision history for this message
Dhruti Shastri(OpenERP) (dhs-openerp) wrote :

Hello Stijn,

This is getting interesting.

If you have updated your psql version and you still get the same error, it looks like an issue of query generation(I mean using % in query sounds a better approach).

I will investigate more and will come back on this asap.

Thanks.

Revision history for this message
stijnbe (stijnbe) wrote :

Owkey it looks like I didn't fully revert your patch. I forgot to remove the quotes around %s.
Sorry for seeing this so late. And thanks for your help.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Let me know if I can close this.
Thanks.

Revision history for this message
stijnbe (stijnbe) wrote :

You can close this issue sorry for wasting your time. But in the meanwhile I learned something more about openerp and python.
Thanks

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Thanks for the response.

Changed in openobject-server:
status: New → Invalid
milestone: none → 6.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.