[FIX] web: headless search views are ready from start
authorDenis Ledoux <dle@odoo.com>
Tue, 29 Jul 2014 17:38:28 +0000 (19:38 +0200)
committerDenis Ledoux <dle@odoo.com>
Tue, 29 Jul 2014 17:38:28 +0000 (19:38 +0200)
commit70605240a9e4e0279bd339c3d80cab3862a58abd
treeed44ff7a2a402eae9df66cdac4ea6a00e6314ebd
parenta052a72c8ae7c2f4aad424f25062ff71272af201
[FIX] web: headless search views are ready from start

function start, line 783, filters_ready waits for fields_view_get deferred to be resolved before calling prepare_filters, which prepare the view filters.

The thing is that, at line 416, if this.headless boolean is true, the searchview is marked as ready (by resolving the this.ready deferred), and the fields_view_get deferred will never be resolved, as it is resolved in the else case, where the this.headless boolean is false.

Therefore, in this.headless true case, this prevents the deferred $.when(this._super(), filters_ready) to be resolved, as the deferred filters_ready will never be resolved. Therefore, the deferred returned by the start function is never resolved, and the searchview will never be regarded as ready neither.

In views.js, the ViewManager is marked as ready when the deferred manager_ready = $.when(searchview_loaded, main_view_loaded, this.view_completely_inited) is resolved. In the this.headless true case, as the searchview is never marked as ready, the manager isn't neither.

This leaded to some issues, like the action buttons in form views being disabled on click, and never re-enabled once the action/wizard executed. See opw-610723
addons/web/static/src/js/search.js