summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2011-10-04 17:42:46 +0200
committerXavier Morel <xmo@openerp.com>2011-10-04 17:42:46 +0200
commit72b852c2c669b92297d75b8adac6a42e3a1ecf6d (patch)
treefbfb7ed0b400fbf5298cb09301f7e601392c616e /addons/web/static/src/js
parentf164496dc436918855290ed36fcea6d06566975f (diff)
[FIX] insertion position of new lines (in editable lists) in case of lists padded to 5 (empty) lines
bzr revid: xmo@openerp.com-20111004154246-7o1cw016cf9ygem3
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/view_list.js4
-rw-r--r--addons/web/static/src/js/view_list_editable.js15
2 files changed, 15 insertions, 4 deletions
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('</tr>');
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;