diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index dab9fcb7727..936af4de5e1 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -905,13 +905,8 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. this.record_callbacks = { 'remove': function (event, record) { - var $row; - if (!record.get('id')) { - $row = self.$current.children(':not([data-id])'); - } else { - $row = self.$current.children( - '[data-id=' + record.get('id') + ']'); - } + var $row = self.$current.children( + '[data-id=' + record.get('id') + ']'); var index = $row.data('index'); $row.remove(); self.refresh_zebra(index); @@ -928,7 +923,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. self.dataset.ids.splice( self.records.indexOf(record), 0, value); // Set id on new record - $row = self.$current.children('tr:not([data-id])'); + $row = self.$current.children('[data-id=false]'); } else { $row = self.$current.children( '[data-id=' + record.get('id') + ']'); diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 1285e48885f..e66fdc1c917 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -125,7 +125,7 @@ openerp.web.list_editable = function (instance) { startEdition: function (record) { var self = this; if (!record) { - var attrs = {}; + var attrs = {id: false}; _(this.columns).chain() .filter(function (x) { return x.tag === 'field'}) .pluck('name') @@ -499,12 +499,8 @@ openerp.web.list_editable = function (instance) { * @return {jQuery|null} */ getRowFor: function (record) { - var id, $row; - if (id = record.get('id')) { - $row = this.$current.children('[data-id=' + id + ']'); - } else { - $row = this.$current.children(':not([data-id])'); - } + var id; + var $row = this.$current.children('[data-id=' + record.get('id') + ']'); if ($row.length) { return $row; }