one2many context evaluation causes error on empty fields

Bug #1099503 reported by Niels Huylebroeck on 2013-01-14
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

I have a view defined as follows:

<field name="field1"/>
<button name="%(action_ref)d" type="action" string="Wizard Action" context="{'current_conf': field1}"/>

In the model field1 is a one2many.
Whenever I click on the button I get the error NameError: name 'field1' is not defined.
The cause as I traced it is in the toContext function in the view_list.js file. => http://bazaar.launchpad.net/~openerp/openerp-web/7.0/view/head:/addons/web/static/src/js/view_list.js#L1773

There the testing of (val instanceof Array) does not keep in mind that Array[0] can be undefined, when it is undefined it laters raises the error in PY_ensurepy() call => http://bazaar.launchpad.net/~openerp/openerp-web/7.0/view/head:/addons/web/static/lib/py.js/lib/py.js#L366

To remedy this I have added a small fix which would be applied on the view_list.js file. (See attachment)

Similar but not duplicate of : https://bugs.launchpad.net/openerp-web/+bug/1088842

Niels Huylebroeck (red15) wrote :
Niels Huylebroeck (red15) wrote :

Just noticed that even the original output makes it so that if the field in question is a one2many only the first entry of the one2many is put in the context (my patch does not fix this as this is an unrelated issue)

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

Other bug subscribers