summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-05-30 11:39:16 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-05-30 11:39:16 +0200
commitbedf81f2da5b92bd1b189419cb7168ed83e06e7e (patch)
treeeadf43209b16feb56e18b7ca4a0ef3a67817ec47 /addons/web/static/src
parent41abe400404a26cff72e2ae979eedf2b04efab12 (diff)
[fix] m2mtags shoul dhide records already added in search
bzr revid: nicolas.vanhoren@openerp.com-20120530093916-yhbu70cp2g9cnxsv
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_form.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 5f3d3faef5e..ca1d576a8e5 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -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());