[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
This commit is contained in:
Xavier Morel 2012-10-17 15:43:51 +02:00
parent 886767fbaa
commit 8e54c76845
1 changed files with 3 additions and 4 deletions

View File

@ -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')
});