From d875f7726c7844d416116a8b02457f50cbd65d1d Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Tue, 26 May 2015 09:05:43 +0200 Subject: [PATCH] [FIX] move our patched equals operator to top of list --- .../static/src/js/web_advanced_search_x2x.js | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js b/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js index 3f299e80..37a5d2f2 100644 --- a/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js +++ b/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js @@ -27,11 +27,30 @@ openerp.web_advanced_search_x2x = function(instance) { template: 'web_advanced_search_x2x.extended_search.proposition.many2one', searchfield: null, + init: function() + { + this.operators = _.sortBy( + this.operators, + function(op) + { + switch(op.value) + { + case '=': + return -2; + case '!=': + return -1; + default: + return 0; + } + }); + return this._super.apply(this, arguments); + }, start: function() { this.getParent().$('.searchview_extended_prop_op') .on('change', this.proxy('operator_changed')); - return this._super.apply(this, arguments); + return this._super.apply(this, arguments).then( + this.proxy(this.operator_changed)); }, get_field_desc: function() {