From 8e54c76845dc4bc7bffaa971ed7a4070a00eee65 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 17 Oct 2012 15:43:51 +0200 Subject: [PATCH] [FIX] fetching of table cells to match form inputs to Only fetch the table cells of the row being edited *after* having saved a pending edition. Otherwise, when re-editing the same record (e.g. click between buttons or on a readonly field), the cells are saved, the record is refreshed destroying the cells, and when trying to get the cell positions to position form fields correctly... the cells which don't exist anymore return 0, 0 as their position and nothing works correctly. bzr revid: xmo@openerp.com-20121017134351-lpmz27f1iemmsfoq --- addons/web/static/src/js/view_list_editable.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index cd6b018ea0d..3a3b06cbedf 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -190,10 +190,10 @@ openerp.web.list_editable = function (instance) { this.records.add(record, { at: this.prepends_on_create() ? 0 : null}); } - var $recordRow = this.groups.get_row_for(record); - var cells = this.get_cells_for($recordRow); return this.ensure_saved().pipe(function () { + var $recordRow = self.groups.get_row_for(record); + var cells = self.get_cells_for($recordRow); self.fields_for_resize.splice(0, self.fields_for_resize.length); return self.with_event('edit', { record: record.attributes, @@ -398,7 +398,6 @@ openerp.web.list_editable = function (instance) { setup_events: function () { var self = this; _.each(this.editor.form.fields, function(field, field_name) { - var field; var setting = false; var set_invisible = function() { if (!setting && field.get("effective_readonly")) { @@ -774,7 +773,7 @@ openerp.web.list_editable = function (instance) { return this._super.apply(this, arguments); } var record_id = $(event.currentTarget).data('id'); - this.view.start_edition( + return this.view.start_edition( record_id ? this.records.get(record_id) : null, { focus_field: $(event.target).data('field') });