error when an m2m field is updated by an onchange

Bug #917793 reported by Christophe Combelles
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Web Client
Confirmed
Low
OpenERP Publisher's Warranty Team

Bug Description

This bug only appears in the web client, just like #906449.

- Create a view (in our case a wizard) with two fields, the second one being a many2many.
- In an onchange callback on the first field, return something that will update the many2many field (something like { 'value': [1, 2, 3] }).
- When you validate the view or wizard, the server receives [(1, 2, 3)] instead of [1, 2, 3] and fails on a SQL request.

The error shows up in the server log as :
LIGNE 1 : ....id FROM "account_period" WHERE account_period.id IN ((1, 2,...
The SQL request should rather be :
 ....id FROM "account_period" WHERE account_period.id IN (1, 2,...

==> After hours of digging, we found the error here :
webclient/addons/openerp/widgets/listgrid.py : 173

        if ids and not isinstance(ids, list):
            ids = [ids]

It should rather be:

        if ids and not isinstance(ids, (list, tuple)):
            ids = [ids]

For any reason, the [1, 2, 3] list coming from the server is converted to a tuple, when it reaches the web client. The web client then wraps it in a list and at the end ids = [(1, 2, 3)] instead of [1, 2, 3].

Related branches

Amit Parik (amit-parik)
Changed in openobject-client-web:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
importance: Undecided → Low
status: New → Confirmed
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.