diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2011-05-19 18:18:35 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2011-05-19 18:18:35 +0200 |
| commit | 0ce128b59ea3dff85100c306c60b50ec7d27b6bd (patch) | |
| tree | f8aebd810f6d83f6b8efcf42796347e371c0be27 /addons/base/static/src/js/search.js | |
| parent | 50434b10bc39e6682fa027f10ffce51b6a712b33 (diff) | |
[IMP] Added integer and float to custom filters.
bzr revid: nicolas.vanhoren@openerp.com-20110519161835-blao1wa20xfmutsq
Diffstat (limited to 'addons/base/static/src/js/search.js')
| -rw-r--r-- | addons/base/static/src/js/search.js | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/addons/base/static/src/js/search.js b/addons/base/static/src/js/search.js index 185b55e7a5f..8d22a068e39 100644 --- a/addons/base/static/src/js/search.js +++ b/addons/base/static/src/js/search.js @@ -911,11 +911,61 @@ openerp.base.search.ExtendedSearchProposition.Date = openerp.base.BaseWidget.ext }); } }); +openerp.base.search.ExtendedSearchProposition.Integer = openerp.base.BaseWidget.extend({ + template: 'SearchView.extended_search.proposition.integer', + identifier_prefix: 'extended-search-proposition-integer', + operators: [ + {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"} + ], + get_value: function() { + val = this.$element.val(); + val2 = parseFloat(val); + if(val2 != 0 && !val2) { + return ""; + } + return Math.round(val2); + } +}); +openerp.base.search.ExtendedSearchProposition.Float = openerp.base.BaseWidget.extend({ + template: 'SearchView.extended_search.proposition.float', + identifier_prefix: 'extended-search-proposition-float', + operators: [ + {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"} + ], + get_value: function() { + val = this.$element.val(); + val2 = parseFloat(val); + if(val2 != 0 && !val2) { + return ""; + } + return val2; + } +}); openerp.base.search.custom_filters = new openerp.base.Registry({ 'char': 'openerp.base.search.ExtendedSearchProposition.Char', + 'text': 'openerp.base.search.ExtendedSearchProposition.Char', + 'one2many': 'openerp.base.search.ExtendedSearchProposition.Char', + 'many2one': 'openerp.base.search.ExtendedSearchProposition.Char', + 'many2many': 'openerp.base.search.ExtendedSearchProposition.Char', + 'datetime': 'openerp.base.search.ExtendedSearchProposition.DateTime', - 'date': 'openerp.base.search.ExtendedSearchProposition.Date' + 'date': 'openerp.base.search.ExtendedSearchProposition.Date', + 'integer': 'openerp.base.search.ExtendedSearchProposition.Integer', + 'float': 'openerp.base.search.ExtendedSearchProposition.Float', + + 'selection': 'openerp.base.search.ExtendedSearchProposition.Char', + 'boolean': 'openerp.base.search.ExtendedSearchProposition.Char', }); }; |
