[fix] problem with char's validity

bzr revid: nicolas.vanhoren@openerp.com-20120319153406-td0j8nu5g20z9ay3
This commit is contained in:
niv-openerp 2012-03-19 16:34:06 +01:00
parent 0e4a8c7ff9
commit 4b98b8f127
1 changed files with 7 additions and 5 deletions

View File

@ -1501,11 +1501,13 @@ openerp.web.form.FieldChar = openerp.web.form.AbstractField.extend(_.extend({},
},
validate: function() {
this.invalid = false;
try {
var value = openerp.web.parse_value(this.$element.find('input').val(), this, '');
this.invalid = this.required && value === '';
} catch(e) {
this.invalid = true;
if (!this.get("effective_readonly")) {
try {
var value = openerp.web.parse_value(this.$element.find('input').val(), this, '');
this.invalid = this.required && value === '';
} catch(e) {
this.invalid = true;
}
}
},
focus: function($element) {