[IMP] view_form: do not display hugly error message when name_get returns no value but more helpful message (eg: bad default value returns wrong id)

bzr revid: mat@openerp.com-20140114145720-r3lg0qjezqj4p3i1
This commit is contained in:
Martin Trigaux 2014-01-14 15:57:20 +01:00
parent a7cb9b762d
commit 3f4c637674
1 changed files with 4 additions and 0 deletions

View File

@ -3299,6 +3299,10 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
if (! no_recurse) {
var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.build_context());
this.alive(dataset.name_get([self.get("value")])).done(function(data) {
if (!data[0]) {
self.do_warn(_t("Render"), _t("No value found for the field "+self.field.string+" for value "+self.get("value")));
return;
}
self.display_value["" + self.get("value")] = data[0][1];
self.render_value(true);
});