From ed66b02fe67e714bf0a90e46cdafc742047cb3bc Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 31 Oct 2012 11:19:59 +0100 Subject: [IMP] view form: add many2many_tag_email widget bzr revid: chm@openerp.com-20121031101959-t4o6qusszamx5qgu --- addons/web/static/src/js/view_form.js | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 5ecad26e5df..a6fcd2c46cb 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3955,6 +3955,41 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in }, }); + +/** + * Extend of FieldMany2ManyTags widget method. + * When the user add a partner and the partner don't have an email, open a popup to purpose to add an email. + * The user can choose to add an email or cancel and close the popup. + */ +instance.web.form.FieldMany2ManyTagsEmail = instance.web.form.FieldMany2ManyTags.extend({ + add_id: function(id) { + this._super.apply(this, arguments); + + var self = this; + new instance.web.Model('res.partner').call("read", [id, ["email"]], {context: this.build_context()}).pipe(function (dict) { + if (!dict.email) { + if (! confirm(_t("This partner don't have email.\nDo you want to complete the partner's informations?"))) { return false; } + self.on_complete_informations(dict); + } + }); + }, + + on_complete_informations: function (dict) { + var self = this; + + var pop = new instance.web.form.FormOpenPopup(self); + pop.show_element( + 'res.partner', + dict.id, + self.build_context(), + { + title: _t("Complete partner's informations"), + } + ); + }, + +}); + /** widget options: - reload_on_button: Reload the whole form view if click on a button in a list view. @@ -5141,6 +5176,7 @@ instance.web.form.widgets = new instance.web.Registry({ 'many2one' : 'instance.web.form.FieldMany2One', 'many2many' : 'instance.web.form.FieldMany2Many', 'many2many_tags' : 'instance.web.form.FieldMany2ManyTags', + 'many2many_tags_email' : 'instance.web.form.FieldMany2ManyTagsEmail', 'many2many_kanban' : 'instance.web.form.FieldMany2ManyKanban', 'one2many' : 'instance.web.form.FieldOne2Many', 'one2many_list' : 'instance.web.form.FieldOne2Many', -- cgit v1.2.3 From 8526bf26b30be8063c1a072e8b34c46c2a3420fe Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 31 Oct 2012 11:56:04 +0100 Subject: [IMP] view form: no question to complete informations in many2many_tag_email widget bzr revid: chm@openerp.com-20121031105604-952pxf2rhlvupsx1 --- addons/web/static/src/js/view_form.js | 45 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a6fcd2c46cb..575e22751af 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3963,31 +3963,30 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in */ instance.web.form.FieldMany2ManyTagsEmail = instance.web.form.FieldMany2ManyTags.extend({ add_id: function(id) { - this._super.apply(this, arguments); - - var self = this; - new instance.web.Model('res.partner').call("read", [id, ["email"]], {context: this.build_context()}).pipe(function (dict) { - if (!dict.email) { - if (! confirm(_t("This partner don't have email.\nDo you want to complete the partner's informations?"))) { return false; } - self.on_complete_informations(dict); - } - }); - }, - - on_complete_informations: function (dict) { var self = this; - - var pop = new instance.web.form.FormOpenPopup(self); - pop.show_element( - 'res.partner', - dict.id, - self.build_context(), - { - title: _t("Complete partner's informations"), - } - ); + new instance.web.Model('res.partner').call("read", [id, ["email", "notification_email_send"]], {context: this.build_context()}) + .pipe(function (dict) { + if (!dict.email && (dict.notification_email_send == 'all' || dict.notification_email_send == 'comment')) { + var pop = new instance.web.form.FormOpenPopup(self); + pop.show_element( + 'res.partner', + dict.id, + self.build_context(), + { + title: _t("Complete partner's informations"), + } + ); + pop.on('write_completed', self, function () { + self._add_id(dict.id) + }); + } else { + self._add_id(dict.id); + } + }); }, - + _add_id: function (id) { + this.set({'value': _.uniq(this.get('value').concat([id]))}); + } }); /** -- cgit v1.2.3 From 9ee814ca950564e6163ed2865f2e24a07ae26fc9 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 31 Oct 2012 17:44:05 +0100 Subject: [IMP] view form: many2many tag email : message please complete bzr revid: chm@openerp.com-20121031164405-sym3w0cnzszr7i0d --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 575e22751af..e8d05296625 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3973,7 +3973,7 @@ instance.web.form.FieldMany2ManyTagsEmail = instance.web.form.FieldMany2ManyTags dict.id, self.build_context(), { - title: _t("Complete partner's informations"), + title: _t("Please complete partner's informations and Email"), } ); pop.on('write_completed', self, function () { -- cgit v1.2.3 From d3e5d953b1384e92e61fa51ad7b7a75d9c76c913 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 6 Nov 2012 10:57:00 +0100 Subject: [IMP] web: field many2many_tags_email moved to mail addon bzr revid: chm@openerp.com-20121106095700-q5gtxandi7o0jn6o --- addons/web/static/src/js/view_form.js | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e8d05296625..5ecad26e5df 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3955,40 +3955,6 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in }, }); - -/** - * Extend of FieldMany2ManyTags widget method. - * When the user add a partner and the partner don't have an email, open a popup to purpose to add an email. - * The user can choose to add an email or cancel and close the popup. - */ -instance.web.form.FieldMany2ManyTagsEmail = instance.web.form.FieldMany2ManyTags.extend({ - add_id: function(id) { - var self = this; - new instance.web.Model('res.partner').call("read", [id, ["email", "notification_email_send"]], {context: this.build_context()}) - .pipe(function (dict) { - if (!dict.email && (dict.notification_email_send == 'all' || dict.notification_email_send == 'comment')) { - var pop = new instance.web.form.FormOpenPopup(self); - pop.show_element( - 'res.partner', - dict.id, - self.build_context(), - { - title: _t("Please complete partner's informations and Email"), - } - ); - pop.on('write_completed', self, function () { - self._add_id(dict.id) - }); - } else { - self._add_id(dict.id); - } - }); - }, - _add_id: function (id) { - this.set({'value': _.uniq(this.get('value').concat([id]))}); - } -}); - /** widget options: - reload_on_button: Reload the whole form view if click on a button in a list view. @@ -5175,7 +5141,6 @@ instance.web.form.widgets = new instance.web.Registry({ 'many2one' : 'instance.web.form.FieldMany2One', 'many2many' : 'instance.web.form.FieldMany2Many', 'many2many_tags' : 'instance.web.form.FieldMany2ManyTags', - 'many2many_tags_email' : 'instance.web.form.FieldMany2ManyTagsEmail', 'many2many_kanban' : 'instance.web.form.FieldMany2ManyKanban', 'one2many' : 'instance.web.form.FieldOne2Many', 'one2many_list' : 'instance.web.form.FieldOne2Many', -- cgit v1.2.3 From af2c38f4c9a7da9ae0de7652ca098910cbaee09e Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 6 Nov 2012 13:52:06 +0100 Subject: [IMP] web: trigger closing for popup bzr revid: chm@openerp.com-20121106125206-icm2s8fvb13m40w9 --- addons/web/static/src/js/view_form.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 5ecad26e5df..435384bfe60 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4427,6 +4427,7 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ this.destroy(); }, destroy: function () { + this.trigger('closing'); this.$el.dialog('close'); this._super(); }, -- cgit v1.2.3 From 4f52103aa03d3ad1d1464699b562684ea6cd73f2 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 6 Nov 2012 15:05:19 +0100 Subject: [FIX] double html-escaping of group titles in grouped lists (eg analysis) bzr revid: xmo@openerp.com-20121106140519-0qnq934rr44l6kgt --- addons/web/static/src/js/view_list.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index fd74fd8922b..f1fd26eed4d 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1306,9 +1306,11 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we process_modifiers: false }); } catch (e) { - group_label = row_data[group_column.id].value; + group_label = _.str.escapeHTML(row_data[group_column.id].value); } - $group_column.text(_.str.sprintf("%s (%d)", + // group_label is html-clean (through format or explicit + // escaping if format failed), can inject straight into HTML + $group_column.html(_.str.sprintf("%s (%d)", group_label, group.length)); if (group.length && group.openable) { -- cgit v1.2.3 From 9304ac6594eb13cb911ccebbea60f0d7b35f91ee Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 6 Nov 2012 15:18:35 +0100 Subject: [FIX] width of progress bars in list view bzr revid: xmo@openerp.com-20121106141835-fd8spbm93h3etjps --- addons/web/static/src/css/base.css | 3 +++ addons/web/static/src/css/base.sass | 2 ++ 2 files changed, 5 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index b030d0712f0..c97b59ec6fe 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2777,6 +2777,9 @@ content: "}"; color: #e0e0e0; } +.openerp .oe_list_content .oe_list_field_progressbar progress { + width: 100%; +} .openerp .tree_header { background-color: #f0f0f0; border-bottom: 1px solid #cacaca; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 79a688cf823..18451352370 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2193,6 +2193,8 @@ $sheet-padding: 16px .oe_list_handle @include text-to-entypo-icon("}",#E0E0E0,18px) margin-right: 7px + .oe_list_field_progressbar progress + width: 100% // }}} // Tree view {{{ .tree_header -- cgit v1.2.3 From 2ebaa6f666ac9f8ec30db92c0bf9ca68864e4289 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 6 Nov 2012 15:47:36 +0100 Subject: [FIX] searchview drawer closing when clicking advanced proposition handler for "global click filtered by whether click target is outside of search view" executed after prop deletion handler has executed => the whole proposition has already been removed from the document and thus isn't a descendent of the searchview anymore => test matches and drawer closes. Altered handler to stop propagation so does not reach global handler. bzr revid: xmo@openerp.com-20121106144736-l0pde7phf3nake4t --- addons/web/static/src/js/search.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 520dcd9169f..256e94f23ae 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1699,6 +1699,13 @@ instance.web.search.Advanced = instance.web.search.Input.extend({ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @lends instance.web.search.ExtendedSearchProposition# */{ template: 'SearchView.extended_search.proposition', + events: { + 'change .searchview_extended_prop_field': 'changed', + 'click .searchview_extended_delete_prop': function (e) { + e.stopPropagation(); + this.destroy(); + } + }, /** * @constructs instance.web.search.ExtendedSearchProposition * @extends instance.web.Widget @@ -1716,13 +1723,6 @@ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @ this.value = null; }, start: function () { - var _this = this; - this.$el.find(".searchview_extended_prop_field").change(function() { - _this.changed(); - }); - this.$el.find('.searchview_extended_delete_prop').click(function () { - _this.destroy(); - }); this.changed(); }, changed: function() { -- cgit v1.2.3 From a006b078ed4fa9fa668ee3a4b25b926e56e1b09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 6 Nov 2012 15:59:40 +0100 Subject: [REVIEW] trigger closing -> trigger closed, to match the code guidelines. bzr revid: tde@openerp.com-20121106145940-cji6varovqtgneiz --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 6447c2241cf..6a853c4bef9 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4420,7 +4420,7 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ this.destroy(); }, destroy: function () { - this.trigger('closing'); + this.trigger('closed'); this.$el.dialog('close'); this._super(); }, -- cgit v1.2.3 From a501903c23e639623f41471660b20ba64817aab8 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 6 Nov 2012 16:04:49 +0100 Subject: [IMP] convert searchview to DOM events hash bzr revid: xmo@openerp.com-20121106150449-1sxybk8jml7xa2ji --- addons/web/static/src/js/search.js | 155 +++++++++++++++++-------------------- 1 file changed, 73 insertions(+), 82 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 256e94f23ae..55ffab0f7a7 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -124,19 +124,10 @@ function assert(condition, message) { } my.InputView = instance.web.Widget.extend({ template: 'SearchView.InputView', - start: function () { - var p = this._super.apply(this, arguments); - this.$el.on('focus', this.proxy('onFocus')); - this.$el.on('blur', this.proxy('onBlur')); - this.$el.on('keydown', this.proxy('onKeydown')); - return p; - }, - onFocus: function () { - this.trigger('focused', this); - }, - onBlur: function () { - this.$el.text(''); - this.trigger('blurred', this); + events: { + focus: function () { this.trigger('focused', this); }, + blur: function () { this.$el.text(''); this.trigger('blurred', this); }, + keydown: 'onKeydown' }, getSelection: function () { // get Text node @@ -212,6 +203,27 @@ my.InputView = instance.web.Widget.extend({ }); my.FacetView = instance.web.Widget.extend({ template: 'SearchView.FacetView', + events: { + 'focus': function () { this.trigger('focused', this); }, + 'blur': function () { this.trigger('blurred', this); }, + 'click': function (e) { + if ($(e.target).is('.oe_facet_remove')) { + this.model.destroy(); + return false; + } + this.$el.focus(); + e.stopPropagation(); + }, + 'keydown': function (e) { + var keys = $.ui.keyCode; + switch (e.which) { + case keys.BACKSPACE: + case keys.DELETE: + this.model.destroy(); + return false; + } + } + }, init: function (parent, model) { this._super(parent); this.model = model; @@ -223,33 +235,11 @@ my.FacetView = instance.web.Widget.extend({ }, start: function () { var self = this; - this.$el.on('focus', function () { self.trigger('focused', self); }); - this.$el.on('blur', function () { self.trigger('blurred', self); }); - this.$el.on('click', function (e) { - if ($(e.target).is('.oe_facet_remove')) { - self.model.destroy(); - return false; - } - self.$el.focus(); - e.stopPropagation(); - }); - this.$el.on('keydown', function (e) { - var keys = $.ui.keyCode; - switch (e.which) { - case keys.BACKSPACE: - case keys.DELETE: - self.model.destroy(); - return false; - } - }); var $e = self.$el.find('> span:last-child'); - var q = $.when(this._super()); - return q.pipe(function () { - var values = self.model.values.map(function (value) { + return $.when(this._super()).pipe(function () { + return $.when.apply(null, self.model.values.map(function (value) { return new my.FacetValueView(self, value).appendTo($e); - }); - - return $.when.apply(null, values); + })); }); }, model_changed: function () { @@ -274,6 +264,48 @@ my.FacetValueView = instance.web.Widget.extend({ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.SearchView# */{ template: "SearchView", + events: { + // focus last input if view itself is clicked + 'click': function (e) { + if (e.target === this.$el.find('.oe_searchview_facets')[0]) { + this.$el.find('.oe_searchview_input:last').focus(); + } + }, + // when the completion list opens/refreshes, automatically select the + // first completion item so if the user just hits [RETURN] or [TAB] it + // automatically selects it + 'autocompleteopen': function () { + var menu = this.$el.data('autocomplete').menu; + menu.activate( + $.Event({ type: "mouseenter" }), + menu.element.children().first()); + }, + // search button + 'click button.oe_searchview_search': function (e) { + e.stopImmediatePropagation(); + this.do_search(); + }, + 'click .oe_searchview_clear': function (e) { + e.stopImmediatePropagation(); + this.query.reset(); + }, + 'click .oe_searchview_unfold_drawer': function (e) { + e.stopImmediatePropagation(); + this.$el.toggleClass('oe_searchview_open_drawer'); + }, + 'keydown .oe_searchview_input, .oe_searchview_facet': function (e) { + switch(e.which) { + case $.ui.keyCode.LEFT: + this.focusPreceding(this); + e.preventDefault(); + break; + case $.ui.keyCode.RIGHT: + this.focusFollowing(this); + e.preventDefault(); + break; + } + } + }, /** * @constructs instance.web.SearchView * @extends instance.web.Widget @@ -331,55 +363,11 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea }); } - // Launch a search on clicking the oe_searchview_search button - this.$el.on('click', 'button.oe_searchview_search', function (e) { - e.stopImmediatePropagation(); - self.do_search(); - }); - - this.$el.on('keydown', - '.oe_searchview_input, .oe_searchview_facet', function (e) { - switch(e.which) { - case $.ui.keyCode.LEFT: - self.focusPreceding(this); - e.preventDefault(); - break; - case $.ui.keyCode.RIGHT: - self.focusFollowing(this); - e.preventDefault(); - break; - } - }); - - this.$el.on('click', '.oe_searchview_clear', function (e) { - e.stopImmediatePropagation(); - self.query.reset(); - }); - this.$el.on('click', '.oe_searchview_unfold_drawer', function (e) { - e.stopImmediatePropagation(); - self.$el.toggleClass('oe_searchview_open_drawer'); - }); instance.web.bus.on('click', this, function(ev) { if ($(ev.target).parents('.oe_searchview').length === 0) { self.$el.removeClass('oe_searchview_open_drawer'); } }); - // Focus last input if the view itself is clicked (empty section of - // facets element) - this.$el.on('click', function (e) { - if (e.target === self.$el.find('.oe_searchview_facets')[0]) { - self.$el.find('.oe_searchview_input:last').focus(); - } - }); - // when the completion list opens/refreshes, automatically select the - // first completion item so if the user just hits [RETURN] or [TAB] it - // automatically selects it - this.$el.on('autocompleteopen', function () { - var menu = self.$el.data('autocomplete').menu; - menu.activate( - $.Event({ type: "mouseenter" }), - menu.element.children().first()); - }); return $.when(p, this.ready); }, @@ -736,6 +724,9 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea * * If at least one field failed its validation, triggers * :js:func:`instance.web.SearchView.on_invalid` instead. + * + * @param [_query] + * @param {Object} [options] */ do_search: function (_query, options) { if (options && options.preventSearch) { -- cgit v1.2.3 From e3e54b0e7a906d4fdce243b88be83798dd71d041 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 6 Nov 2012 16:21:48 +0100 Subject: [IMP] port searchview to helpers bzr revid: xmo@openerp.com-20121106152148-33ctafxz5iy53nl1 --- addons/web/static/src/js/search.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 55ffab0f7a7..b2ded00c105 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -235,7 +235,7 @@ my.FacetView = instance.web.Widget.extend({ }, start: function () { var self = this; - var $e = self.$el.find('> span:last-child'); + var $e = this.$('> span:last-child'); return $.when(this._super()).pipe(function () { return $.when.apply(null, self.model.values.map(function (value) { return new my.FacetValueView(self, value).appendTo($e); @@ -267,8 +267,8 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea events: { // focus last input if view itself is clicked 'click': function (e) { - if (e.target === this.$el.find('.oe_searchview_facets')[0]) { - this.$el.find('.oe_searchview_input:last').focus(); + if (e.target === this.$('.oe_searchview_facets')[0]) { + this.$('.oe_searchview_input:last').focus(); } }, // when the completion list opens/refreshes, automatically select the @@ -468,7 +468,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea * div[contenteditable].oe_searchview_input) */ currentInputValue: function () { - return this.$el.find('div.oe_searchview_input:focus').text(); + return this.$('div.oe_searchview_input:focus').text(); }, /** * Provide auto-completion result for req.term (an array to `resp`) @@ -498,7 +498,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea var input_index = _(this.input_subviews).indexOf( this.subviewForRoot( - this.$el.find('div.oe_searchview_input:focus')[0])); + this.$('div.oe_searchview_input:focus')[0])); this.query.add(ui.item.facet, {at: input_index / 2}); }, childFocused: function () { @@ -527,7 +527,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea // _2: undefined if event=change, otherwise model var self = this; var started = []; - var $e = this.$el.find('div.oe_searchview_facets'); + var $e = this.$('div.oe_searchview_facets'); _.invoke(this.input_subviews, 'destroy'); this.input_subviews = []; @@ -652,7 +652,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea // build drawer var drawer_started = $.when.apply( null, _(this.select_for_drawer()).invoke( - 'appendTo', this.$el.find('.oe_searchview_drawer'))); + 'appendTo', this.$('.oe_searchview_drawer'))); // load defaults var defaults_fetched = $.when.apply(null, _(this.inputs).invoke( @@ -952,7 +952,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in */ search_change: function () { var self = this; - var $filters = this.$el.find('> li').removeClass('oe_selected'); + var $filters = this.$('> li').removeClass('oe_selected'); var facet = this.view.query.find(_.bind(this.match_facet, this)); if (!facet) { return; } facet.values.each(function (v) { @@ -1503,7 +1503,7 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({ }).pipe(this.proxy('set_filters')); }, clear_selection: function () { - this.$el.find('li.oe_selected').removeClass('oe_selected'); + this.$('li.oe_selected').removeClass('oe_selected'); }, append_filter: function (filter) { var self = this; @@ -1515,7 +1515,7 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({ } else { var id = filter.id; $filter = this.filters[key] = $('
  • ') - .appendTo(this.$el.find('.oe_searchview_custom_list')) + .appendTo(this.$('.oe_searchview_custom_list')) .addClass(filter.user_id ? 'oe_searchview_custom_private' : 'oe_searchview_custom_public') .text(filter.name); @@ -1550,8 +1550,8 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({ }, save_current: function () { var self = this; - var $name = this.$el.find('input:first'); - var private_filter = !this.$el.find('input:last').prop('checked'); + var $name = this.$('input:first'); + var private_filter = !this.$('input:last').prop('checked'); var search = this.view.build_search_data(); this.rpc('/web/session/eval_domain_and_context', { @@ -1657,7 +1657,7 @@ instance.web.search.Advanced = instance.web.search.Input.extend({ }, append_proposition: function () { return (new instance.web.search.ExtendedSearchProposition(this, this.fields)) - .appendTo(this.$el.find('ul')); + .appendTo(this.$('ul')); }, commit_search: function () { var self = this; @@ -1717,7 +1717,7 @@ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @ this.changed(); }, changed: function() { - var nval = this.$el.find(".searchview_extended_prop_field").val(); + var nval = this.$(".searchview_extended_prop_field").val(); if(this.attrs.selected == null || nval != this.attrs.selected.name) { this.select_field(_.detect(this.fields, function(x) {return x.name == nval;})); } @@ -1732,7 +1732,7 @@ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @ if(this.attrs.selected != null) { this.value.destroy(); this.value = null; - this.$el.find('.searchview_extended_prop_op').html(''); + this.$('.searchview_extended_prop_op').html(''); } this.attrs.selected = field; if(field == null) { @@ -1748,9 +1748,9 @@ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @ _.each(this.value.operators, function(operator) { $('