From a905ab7f178ee082642c4d7bf9908cdb3d69fd3d Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 8 Jun 2011 15:51:41 +0200 Subject: [PATCH] [IMP] don't wait for the bloody record to be fully loaded to fixup cell styles and add groupby columns (in case of grouping), it makes the list titles jittery which looks terrible. Instead, can fixup the row right after rendering, which makes the whole thing much stabler bzr revid: xmo@openerp.com-20110608135141-g6rz1g77ykyg2cja --- addons/base/static/src/js/list-editable.js | 35 ++++++++++------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/addons/base/static/src/js/list-editable.js b/addons/base/static/src/js/list-editable.js index fd20a51c0ef..9bbde25a74d 100644 --- a/addons/base/static/src/js/list-editable.js +++ b/addons/base/static/src/js/list-editable.js @@ -158,26 +158,23 @@ openerp.base.list.editable = function (openerp) { template: 'ListView.row.form', registry: openerp.base.list.form.widgets }); - this.edition_form.on_loaded({fields_view: this.get_fields_view()}); - this.edition_form.on_record_loaded.add({ - position: 'last', - unique: true, - callback: function () { - var $e = self.edition_form.$element; - $e.find('td') - .addClass('oe-field-cell') - .removeAttr('width') - .end() - .find('td:first').removeClass('oe-field-cell').end() - .find('td:last').removeClass('oe-field-cell').end(); - _(self.columns).each(function (column) { - if (column.meta) { - $e.prepend(''); - } - }); - } + $.when(this.edition_form.on_loaded({fields_view: this.get_fields_view()})).then(function () { + // put in $.when just in case FormView.on_loaded becomes asynchronous + $new_row.find('td') + .addClass('oe-field-cell') + .removeAttr('width') + .end() + .find('td:first').removeClass('oe-field-cell').end() + .find('td:last').removeClass('oe-field-cell').end(); + // pad in case of groupby + _(self.columns).each(function (column) { + if (column.meta) { + $new_row.prepend(''); + } + }); + + self.edition_form.do_show(); }); - this.edition_form.do_show(); }, /** * Saves the current row, and triggers the edition of its following