From 1acde8ff13f9e2ee4d399e7fa9d5fe724aa4ddd1 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 31 Mar 2011 14:06:27 +0200 Subject: [PATCH] [IMP] move operators to field classes, add datetime field stub bzr revid: xmo@openerp.com-20110331120627-yu28osuqd0r568i1 --- addons/base/static/src/js/search.js | 51 ++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/addons/base/static/src/js/search.js b/addons/base/static/src/js/search.js index ce3113532cc..ddb98debd15 100644 --- a/addons/base/static/src/js/search.js +++ b/addons/base/static/src/js/search.js @@ -439,19 +439,14 @@ openerp.base.search.ExtendedSearchGroup = openerp.base.BaseWidget.extend({ openerp.base.search.extended_filters_types = { char: { - operators: [ - {value: "ilike", text: "contains"}, - {value: "not ilike", text: "doesn't contain"}, - {value: "=", text: "is equal to"}, - {value: "!=", text: "is not equal to"}, - {value: ">", text: "greater than"}, - {value: "<", text: "less than"}, - {value: ">=", text: "greater or equal than"}, - {value: "<=", text: "less or equal than"}, - ], build_component: function(parent) { return new openerp.base.search.ExtendedSearchProposition.Char(parent); } + }, + datetime: { + build_component: function (parent) { + return new openerp.base.search.ExtendedSearchProposition.DateTime(parent); + } } }; @@ -504,14 +499,16 @@ openerp.base.search.ExtendedSearchProposition = openerp.base.BaseWidget.extend({ var type = field.type; var extended_filters_types = openerp.base.search.extended_filters_types; type = type in extended_filters_types ? type : "char"; - _.each(extended_filters_types[type].operators, function(operator) { + + this.value_component = extended_filters_types[type].build_component(this); + + _.each(this.value_component.operators, function(operator) { var option = jQuery('