summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorJulien Mougenot <jum@odoo.com>2019-08-14 13:00:26 +0000
committerJulien Mougenot <jum@odoo.com>2019-08-16 09:03:49 +0000
commit291dad6bc869eeeba9bbb5cf13d498ece9266d2d (patch)
tree3564c7b6784f39252db6505d8363bcd68cc16f46 /addons/web/static/src
parent4817c7f08f2df68ac6897d30da8dc0760b8cb853 (diff)
[FIX] web: fixed crash in editable grouped lists
Adding a line in grouped listviews caused a crash in some cases. Steps to reproduce: - go in any grouped editable list view - click on any "Add a line" cell, but not on the link itself - press ENTER Before this commit: A crash occured. Unable to add a new line. Needed to refresh the page. After this commit: Line addition functionnality properly working even when selecting the outer cell
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js7
1 files changed, 5 insertions, 2 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 af6fa29c210..979e0a41496 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
@@ -1035,7 +1035,10 @@ ListRenderer.include({
ev.stopPropagation();
var self = this;
- var groupId = $(ev.target).data('group-id');
+ // This method can be called when selecting the parent of the link.
+ // We need to ensure that the link is the actual target
+ const target = ev.target.tagName !== 'A' ? ev.target.getElementsByTagName('A')[0] : ev.target;
+ const groupId = target.dataset.groupId;
this.currentGroupId = groupId;
this.unselectRow().then(function () {
self.trigger_up('add_record', {
@@ -1195,7 +1198,7 @@ ListRenderer.include({
var correspondingRow = self._getRow(recordId);
correspondingRow.children().eq(cellIndex).focus();
} else if (self.currentGroupId) {
- self.$('a[data-group-id=' + self.currentGroupId + ']').focus();
+ self.$('a[data-group-id="' + self.currentGroupId + '"]').focus();
} else {
self.$('.o_field_x2many_list_row_add a:first').focus(); // FIXME
}