Comment 0 for bug 1048643

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

If you open a dialog with a button defined on a list view, close it, do a different search and open the dialog again, it will throw the error 'record is undefined'.

To reproduce:
* Go to Settings->Modules->Modules
* Switch to list view
* Search for crm
* Click the install button for crm
* Close the dialog
* Search for account
* Click the install button for account
* Try to close the dialog
/error/

Analysis:
The dialog created in http://bazaar.launchpad.net/~openerp/openerp-web/6.1/view/head:/addons/web/static/src/js/views.js#L141 is recycled when a button is pressed multiple times, specifically on_close is not updated. But as the on_closed function that is passed uses record_id from the closure where it is created (see http://bazaar.launchpad.net/~openerp/openerp-web/6.1/view/head:/addons/web/static/src/js/view_list.js#L873), it will always search for the record_id of the first record for which the button was clicked.
This then goes wrong if the current search result doesn't contain this record.

Trunk has the same problem, even though http://bazaar.launchpad.net/~openerp/openerp-web/trunk/revision/2863.1.6 fixes the closure, you still end up calling reload_record with the wrong id.

Patch follows in a while.