[FIX] some badly implemented function fields return empty strings (for e.g. dates, instead of False)

treat empty strings as 'false' except for char fields

bzr revid: xmo@openerp.com-20111116100416-0713i9va49ffbzlh
This commit is contained in:
Xavier Morel 2011-11-16 11:04:16 +01:00
parent 4ea75b0da9
commit e33b9a722e
1 changed files with 6 additions and 0 deletions

View File

@ -76,7 +76,13 @@ openerp.web.format_value = function (value, descriptor, value_if_empty) {
if (typeof value === 'number' && isNaN(value)) {
value = false;
}
//noinspection FallthroughInSwitchStatementJS
switch (value) {
case '':
if (descriptor.type === 'char') {
return '';
}
console.warn('Field', descriptor, 'had an empty string as value, treating as false...');
case false:
case Infinity:
case -Infinity: