[FIX] don't forget the action's domain when performing a search

bzr revid: xmo@openerp.com-20110412072356-gcbuv9ybi6ohx9uz
This commit is contained in:
Xavier Morel 2011-04-12 09:23:56 +02:00
parent 0006e356f9
commit 8fb463acae
1 changed files with 20 additions and 2 deletions

View File

@ -113,8 +113,9 @@ openerp.base.ViewManager = openerp.base.Controller.extend({
this.searchview.stop();
}
this.searchview = new openerp.base.SearchView(this, this.session, this.element_id + "_search", this.dataset, view_id, search_defaults);
this.searchview.on_search.add(function() {
self.views[self.active_view].controller.do_search.apply(self, arguments);
this.searchview.on_search.add(function(domains, contexts, groupbys) {
self.views[self.active_view].controller.do_search.call(
self, domains.concat(self.domains()), contexts, groupbys);
});
return this.searchview.start();
},
@ -128,6 +129,15 @@ openerp.base.ViewManager = openerp.base.Controller.extend({
on_remove: function() {
},
on_edit: function() {
},
/**
* Domains added on searches by the view manager, to override in subsequent
* view manager in order to add new pieces of domains to searches
*
* @returns an empty list
*/
domains: function () {
return [];
}
});
@ -175,6 +185,14 @@ openerp.base.ViewManagerAction = openerp.base.ViewManager.extend({
this.sidebar.stop();
}
this._super();
},
/**
* adds action domain to the search domains
*
* @returns the action's domain
*/
domains: function () {
return [this.action.domain];
}
});