[IMP] shave ~190ms off of *big* listview rendering speed

make conversion of internal Records to form-shape faster by iterating over the attributes object directly instead of using _.each

bzr revid: xmo@openerp.com-20110929145031-q7mqf43gza94ekj6
This commit is contained in:
Xavier Morel 2011-09-29 16:50:31 +02:00
parent 3cde15fe01
commit ba86faac47
1 changed files with 4 additions and 4 deletions

View File

@ -1391,10 +1391,10 @@ var Record = openerp.web.Class.extend(/** @lends Record# */{
* @returns {Object} record displayable in a form view
*/
toForm: function () {
var form_data = {};
_(this.attributes).each(function (value, key) {
form_data[key] = {value: value};
});
var form_data = {}, attrs = this.attributes;
for(var k in attrs) {
form_data[k] = {value: attrs[k]};
}
return {data: form_data};
}