summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2019-04-04 13:57:25 +0000
committerAaron Bohy <aab@odoo.com>2019-04-12 06:14:08 +0000
commit6722e66517bbbc9123bd2e87d8625bf3004c35c8 (patch)
tree40d664284f7533a93c08a8ff88d594f2e646cc79 /addons/web/static/src
parentd43624b5c52bc0b5bd8b6bb36f2a828ff9cbd3eb (diff)
[FIX] web: list: editable="top" with less than 4 records
Before this rev., when adding then discarding a new record in a (main) editable="top" list, the record was added to the top of the list, and then replaced by an empty row when discarding, whereas that empty row should have been rendered below potential data rows.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js
index 9f7cbba8696..b384b122f5f 100644
--- a/addons/web/static/src/js/views/list/list_editable_renderer.js
+++ b/addons/web/static/src/js/views/list/list_editable_renderer.js
@@ -311,7 +311,16 @@ ListRenderer.include({
if (this.state.count >= 4) {
$row.remove();
} else {
- $row.replaceWith(this._renderEmptyRow());
+ // we want to always keep at least 4 (possibly empty) rows
+ var $emptyRow = this._renderEmptyRow();
+ $row.replaceWith($emptyRow);
+ if (this.editable === "top") {
+ // move the empty row we just inserted after data rows
+ var $lastDataRow = this.$('.o_data_row:last');
+ if ($lastDataRow.length) {
+ $emptyRow.insertAfter($lastDataRow);
+ }
+ }
}
},
/**