diff --git a/addons/base/static/src/js/search.js b/addons/base/static/src/js/search.js index 5d6b175ac88..b1a9e295d87 100644 --- a/addons/base/static/src/js/search.js +++ b/addons/base/static/src/js/search.js @@ -435,120 +435,6 @@ openerp.base.search.ExtendedSearchGroup = openerp.base.BaseWidget.extend({ } }); -openerp.base.search.custom_filters = new openerp.base.Registry({ - 'char': 'openerp.base.search.ExtendedSearchProposition.Char', - 'datetime': 'openerp.base.search.ExtendedSearchProposition.DateTime' -}); - -openerp.base.search.ExtendedSearchProposition = openerp.base.BaseWidget.extend({ - template: 'SearchView.extended_search.proposition', - identifier_prefix: 'extended-search-proposition', - init: function (parent, fields) { - this._super(parent); - this.fields = _(fields).chain() - .map(function(val, key) { return _.extend({}, val, {'name': key}); }) - .sortBy(function(field) {return field.string;}) - .value(); - this.attrs = {_: _, fields: this.fields, selected: null}; - this.value = null; - }, - start: function () { - this._super(); - this.select_field(this.fields.length > 0 ? this.fields[0] : null); - var _this = this; - this.$element.find(".searchview_extended_prop_field").change(function() { - _this.changed(); - }); - var delete_btn = this.$element.find('.searchview_extended_delete_prop'); - delete_btn.click(function () { - _this.stop(); - }); - }, - changed: function() { - var nval = this.$element.find(".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;})); - } - }, - /** - * Selects the provided field object - * - * @param field a field descriptor object (as returned by fields_get, augmented by the field name) - */ - select_field: function(field) { - var _this = this; - if(this.attrs.selected != null) { - this.value.stop(); - this.value = null; - this.$element.find('.searchview_extended_prop_op').html(''); - } - this.attrs.selected = field; - if(field == null) { - return; - } - - try { - this.value = new (openerp.base.search.custom_filters.get_object(field.type)) - (this); - _.each(this.value.operators, function(operator) { - var option = jQuery('