[FIX] stupidity: if insert a line in a list with more than 5 records (no padding), since the new line does not have a @data-id yet it's going to remove it immediately.

select line to remove before inserting new one

bzr revid: xmo@openerp.com-20111004155746-q13ieg0q6lsy1uf7
This commit is contained in:
Xavier Morel 2011-10-04 17:57:46 +02:00
parent 74db7dd027
commit 49de0f4640
1 changed files with 2 additions and 2 deletions

View File

@ -148,7 +148,7 @@ openerp.web.list_editable = function (openerp) {
var $new_row = $('<tr>', {
id: _.uniqueId('oe-editable-row-'),
'data-id': record_id,
'class': $(row).attr('class') + ' oe_forms',
'class': row ? $(row).attr('class') : '' + ' oe_forms',
click: function (e) {e.stopPropagation();}
})
.delegate('button.oe-edit-row-save', 'click', function () {
@ -175,6 +175,7 @@ openerp.web.list_editable = function (openerp) {
if (row) {
$new_row.replaceAll(row);
} else if (self.options.editable) {
var $last_child = self.$current.find('> tr:last');
if (self.records.length) {
if (self.options.editable === 'top') {
$new_row.insertBefore(
@ -186,7 +187,6 @@ openerp.web.list_editable = function (openerp) {
} else {
$new_row.prependTo(self.$current);
}
var $last_child = self.$current.find('> tr:last');
if ($last_child.is(':not([data-id])')) {
$last_child.remove();
}