stock_picking.action_invoice_create: calling by xmlrpc raises TypeError

Bug #1030795 reported by Alexandre Fayolle - camptocamp
36
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Low
OpenERP's Framework R&D
OpenERP Community Backports (Server)
Status tracked in 7.0
6.1
Fix Released
Medium
Yann Papouin
7.0
Fix Released
Medium
Yann Papouin

Bug Description

Hello,

When the action_invoice_create method of stock.picking is called via XMLRPC, an exception is reported, because that method returns a dictionary with non-string keys:

      *********** OpenERP Server ERROR ***********
      dictionary key must be string
      Traceback (most recent call last):
        File "/home/afayolle/work/alpes_dev/openerp_buildout/src/server/openerp/wsgi/core.py", line 80, in xmlrpc_return
          response = xmlrpclib.dumps((result,), methodresponse=1, allow_none=False, encoding=None)
        File "/usr/lib/python2.7/xmlrpclib.py", line 1085, in dumps
          data = m.dumps(params)
        File "/usr/lib/python2.7/xmlrpclib.py", line 632, in dumps
          dump(v, write)
        File "/usr/lib/python2.7/xmlrpclib.py", line 654, in __dump
          f(self, value, write)
        File "/usr/lib/python2.7/xmlrpclib.py", line 733, in dump_struct
          raise TypeError, "dictionary key must be string"
      TypeError: dictionary key must be string
      ********************************************

The action is performed correctly, though. And the web client probably ignores the errors. But it is very disturbing when scripting OpenERP to run tests.

I'm reporting this on openobject-addons stable because this is where I observed the issue. I understand that changing this in stable is not going to be possible, but I would appreciate if a fix could be made for this in openobject server trunk.

A simple workaround could be handling TypeError in xmlrpc_return (core.py) when calling xmlrpclib(dumps(...)) and issuing a warning in the server log about this before returning a normal status.

Thanks for your time.

Related branches

summary: - 6.1 stock_picking.action_invoice_create: cannot be called by xmlrpc
+ 6.1 stock_picking.action_invoice_create: calling by xmlrpc raises
+ TypeError
summary: - 6.1 stock_picking.action_invoice_create: calling by xmlrpc raises
- TypeError
+ stock_picking.action_invoice_create: calling by xmlrpc raises TypeError
affects: openobject-addons → openobject-server
Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
lambdasoftware (lambdasoftware) wrote :

We found this error when trying to use price_get function on product.pricelist or product.product, the problem is those methods returns a dictionary with non-string keys.

Revision history for this message
Yann Papouin (yann-papouin) wrote :

This error is more generic and has already been reported in lp:689575 and badly set as "Won't Fix".
I will attach a fix for this issue that currently happens with a lot of functions like:
- get_external_id
- price_get
- get_product_available

As it can be a real pain for third-parties integrators, it can be easily fixed by altering the result of openerp.netsvc.dispatch_rpc without affecting existing xml-rpc behaviour.

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Thanks Yann for working on this issue.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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