[fix] m2mtags shoul dhide records already added in search
bzr revid: nicolas.vanhoren@openerp.com-20120530093916-yhbu70cp2g9cnxsv
This commit is contained in:
parent
41abe40040
commit
bedf81f2da
|
@ -2317,9 +2317,11 @@ instance.web.form.CompletionFieldMixin = {
|
|||
var self = this;
|
||||
|
||||
var dataset = new instance.web.DataSet(this, this.field.relation, self.build_context());
|
||||
var blacklist = this.get_search_blacklist();
|
||||
|
||||
return this.orderer.add(dataset.name_search(
|
||||
search_val, self.build_domain(), 'ilike', this.limit + 1)).pipe(function(data) {
|
||||
search_val, new instance.web.CompoundDomain(self.build_domain(), [["id", "not in", blacklist]]),
|
||||
'ilike', this.limit + 1)).pipe(function(data) {
|
||||
self.last_search = data;
|
||||
// possible selections for the m2o
|
||||
var values = _.map(data, function(x) {
|
||||
|
@ -2357,6 +2359,9 @@ instance.web.form.CompletionFieldMixin = {
|
|||
return values;
|
||||
});
|
||||
},
|
||||
get_search_blacklist: function() {
|
||||
return [];
|
||||
},
|
||||
_quick_create: function(name) {
|
||||
var self = this;
|
||||
var slow_create = function () {
|
||||
|
@ -3181,6 +3186,9 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(_.
|
|||
var tmp = [commands.replace_with(this.get("value"))];
|
||||
return tmp;
|
||||
},
|
||||
get_search_blacklist: function() {
|
||||
return this.get("value");
|
||||
},
|
||||
render_value: function() {
|
||||
var self = this;
|
||||
var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.view.dataset.get_context());
|
||||
|
|
Loading…
Reference in New Issue