[MERGE] [FIX] one2many fields: when sortign on a column of type m2o (format (id, name)), instead of sorting on the tuple (and then id), sort on the name_get value to match what is shown on the screen

bzr revid: mat@openerp.com-20140312150435-shq9hy3b9njkhxsn
This commit is contained in:
Martin Trigaux 2014-03-12 16:04:35 +01:00
commit 82692f11a0
1 changed files with 4 additions and 0 deletions

View File

@ -880,6 +880,10 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
sign = -1;
field = field.slice(1);
}
//m2o should be searched based on value[1] not based whole value(i.e. [id, value])
if(_.isArray(a[field]) && a[field].length == 2 && _.isString(a[field][1])){
return sign * compare(a[field][1], b[field][1]);
}
return sign * compare(a[field], b[field]);
}, 0);
});