[IMP] slightly improve label of advanced search (still not very good)

bzr revid: xmo@openerp.com-20120402114459-1oa6v66uce4cpl0t
This commit is contained in:
Xavier Morel 2012-04-02 13:44:59 +02:00
parent 93e70362e5
commit 1cf64f448f
1 changed files with 8 additions and 3 deletions

View File

@ -1283,7 +1283,12 @@ openerp.web.search.Advanced = openerp.web.search.Input.extend({
},
commit_search: function () {
// Get domain sections from all propositions
var domain = _.invoke(this.getChildren(), 'get_proposition');
var children = this.getChildren(),
domain = _.invoke(children, 'get_proposition'),
label = _(domain).map(function (section) {
return _.str.sprintf('%s(%s)%s',
section[0], section[1], section[2]);
}).join(', ');
// OR all propositions in a single domain: prepend one | for each
// sliding pair of propositions
for(var i=domain.length; --i;) {
@ -1292,7 +1297,7 @@ openerp.web.search.Advanced = openerp.web.search.Input.extend({
// Create Filter (& FilterGroup around it) with that domain
var f = new openerp.web.search.FilterGroup([
new openerp.web.search.Filter({attrs: {
string: 'bobuse',
string: label,
domain: domain
}}, this.view)
], this.view);
@ -1300,7 +1305,7 @@ openerp.web.search.Advanced = openerp.web.search.Input.extend({
// FIXME: holy fucking crap shoot me now
f.toggle_filter({target: {parentNode: {}}});
// remove all propositions
_.invoke(this.getChildren(), 'destroy');
_.invoke(children, 'destroy');
// add new empty proposition
this.append_proposition();
// ? close drawer?