summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/list
diff options
context:
space:
mode:
authorDhruv Patel <dhp@odoo.com>2020-03-19 10:50:21 +0000
committerAaron Bohy <aab@odoo.com>2020-04-08 14:42:03 +0000
commit923988934a2434a7856829d99c285a37a29ae3f7 (patch)
treefcc619c2e75ee0e27f9ce7209752aa6f657ec34f /addons/web/static/src/js/views/list
parent8827c96035a99a17fb4798223bf1c56496a31a61 (diff)
[FIX] web: list: blank line added before data rows
Let's assume an editable="bottom" list view with handle widget and a required field. Moreover, there are less than 4 records in the list, so there are empty lines at the bottom of the list s.t. there are at least 4 rows. Click to add a row: a new row (in edition) is added at the end of the list (instead of an empty row). Do not fill the required field, but instead move another row after the new one (which is still in edition). Then click on discard. Before this commit, the discarded row was replaced by an empty one (s.t. there are always at least 4 rows in the table), but that empty row wasn't added in the bottom of the list. task-2209076 closes odoo/odoo#49251 X-original-commit: 22f43536cb78e07aaab3fd806f3c6c5f068824f3 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/list')
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js10
1 files changed, 4 insertions, 6 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 684fe62465e..697430e24b7 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
@@ -385,12 +385,10 @@ ListRenderer.include({
// 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);
- }
+ // move the empty row we just inserted after last data row
+ const $lastDataRow = this.$('.o_data_row:last');
+ if ($lastDataRow.length) {
+ $emptyRow.insertAfter($lastDataRow);
}
}
},