summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/view_list_editable.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/view_list_editable.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/view_list_editable.js')
-rw-r--r--addons/web/static/src/js/view_list_editable.js15
1 files changed, 12 insertions, 3 deletions
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;