From ad9e1e89167f46273e84ccdf0d2ab694e40144c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 28 Jul 2015 20:44:47 +0200 Subject: [PATCH] Implement add method on Window review15461002 --- src/window.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/window.js b/src/window.js index 42a6aa8f2f..4071b85ea3 100644 --- a/src/window.js +++ b/src/window.js @@ -226,7 +226,28 @@ }, add: function() { - // TODO + var domain = jQuery.extend([], this.domain); + var model_name = this.screen.model_name; + var value = this.wid_text.val(); + + var callback = function(result) { + if (!jQuery.isEmptyObject(result)) { + var ids = []; + for (var i = 0, len = result.length; i < len; i++) { + ids.push(result[i][0]); + } + this.screen.group.load(ids, true); + this.screen.display(); + } + this.entry.val(''); + }.bind(this); + var parser = new Sao.common.DomainParser(); + var win = new Sao.Window.Search(model_name, callback, { + sel_multi: true, + context: this.context, + domain: domain, + search_filter: parser.quote(value) + }); }, remove: function() { this.screen.remove(false, true, false);