diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 719c7117d65..8b7f0fbd3f8 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -815,7 +815,9 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis cells.push(''); var row = cells.join(''); - this.$current.append(new Array(count - this.records.length + 1).join(row)); + this.$current + .find('> tr:not([data-id])').remove().end() + .append(new Array(count - this.records.length + 1).join(row)); this.refresh_zebra(this.records.length); }, /** diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 30a12af0828..7daf2bd0685 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -120,6 +120,7 @@ openerp.web.list_editable = function (openerp) { delete self.edition_id; delete self.edition; }); + this.pad_table_to(5); return cancelled.promise(); }, /** @@ -173,10 +174,18 @@ openerp.web.list_editable = function (openerp) { }); if (row) { $new_row.replaceAll(row); - } else if (self.options.editable === 'top') { - self.$current.prepend($new_row); } else if (self.options.editable) { - self.$current.append($new_row); + if (self.options.editable === 'top') { + $new_row.insertBefore( + self.$current.find('> [data-id]:first')); + } else { + $new_row.insertAfter( + self.$current.find('> [data-id]:last')); + } + var $last_child = self.$current.find('> tr:last'); + if ($last_child.is(':not([data-id])')) { + $last_child.remove(); + } } self.edition = true; self.edition_id = record_id;