one2many context evaluation causes error on empty fields

Bug #1099503 reported by Niels Huylebroeck on 2013-01-14
This bug affects 2 people
Affects Status Importance Assigned to Milestone

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. =>

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 =>

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 :

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