[FIX] get_value called on readonly reference widget before its name_get has had the time to run

lp bug: https://launchpad.net/bugs/919225 fixed

bzr revid: xmo@openerp.com-20120120153046-fkq105mmzooo58q5
This commit is contained in:
Xavier Morel 2012-01-20 16:30:46 +01:00
parent 86b15b7e9d
commit 48459b568a
1 changed files with 8 additions and 1 deletions

View File

@ -198,7 +198,14 @@ openerp.web.page = function (openerp) {
if (!this.value) {
return null;
}
return _.str.sprintf('%s,%d', this.field.relation, this.value[0]);
var id;
if (typeof this.value === 'number') {
// name_get has not run yet
id = this.value;
} else {
id = this.value[0];
}
return _.str.sprintf('%s,%d', this.field.relation, id);
}
});