[IMP] better use underscore methods, don't subscript a 1-character string to get its first character (that's an identity function)

bzr revid: xmo@openerp.com-20110517093503-9kb6newmr7q30z4f
This commit is contained in:
Xavier Morel 2011-05-17 11:35:03 +02:00
parent 9d49ade263
commit fba3f1bfc7
1 changed files with 6 additions and 6 deletions

View File

@ -321,7 +321,7 @@ openerp.base.form.compute_domain = function(expr, fields) {
var ex = expr[i];
if (ex.length == 1) {
var top = stack.pop();
switch (ex[0]) {
switch (ex) {
case '|':
stack.push(stack.pop() || top);
continue;
@ -332,7 +332,7 @@ openerp.base.form.compute_domain = function(expr, fields) {
stack.push(!top);
continue;
default:
throw new Error('Unknown domain operator ' + ex[0]);
throw new Error('Unknown domain operator ' + ex);
}
}
@ -362,17 +362,17 @@ openerp.base.form.compute_domain = function(expr, fields) {
stack.push(field >= val);
break;
case 'in':
stack.push(_.indexOf(val, field) > -1);
stack.push(_(val).contains(field));
break;
case 'not in':
stack.push(_.indexOf(val, field) == -1);
stack.push(!_(val).contains(field));
break;
default:
this.log("Unsupported operator in attrs :", op);
}
}
return _.indexOf(stack, false) == -1;
}
return _.all(stack);
};
openerp.base.form.Widget = openerp.base.Controller.extend({
init: function(view, node) {