diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 1c7f1a1562b..629dc12c780 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -796,13 +796,18 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis var value; if(column.type === 'reference') { value = record.get(column.id); - if (value) { + var ref_match; + // Ensure that value is in a reference "shape", otherwise we're + // going to loop on performing name_get after we've resolved (and + // set) a human-readable version. m2o does not have this issue + // because the non-human-readable is just a number, where the + // human-readable version is a pair + if (value && (ref_match = /([\w\.]+),(\d+)/.exec(value))) { // reference values are in the shape "$model,$id" (as a // string), we need to split and name_get this pair in order // to get a correctly displayable value in the field - var ref = value.split(','), - model = ref[0], - id = parseInt(ref[1], 10); + var model = ref_match[1], + id = parseInt(ref_match[2], 10); new openerp.web.DataSet(this.view, model).name_get([id], function(names) { if (!names.length) { return; } record.set(column.id, names[0][1]);