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 9d270ba3976..7be3f3d4e29 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 @@ -56,6 +56,8 @@ ListRenderer.include({ // of each line, so the user can delete a record. this.addTrashIcon = params.addTrashIcon; + this.editable = this.arch.attrs.editable; + this.currentRow = null; this.currentCol = null; }, @@ -485,6 +487,9 @@ ListRenderer.include({ * @param {MouseEvent} event */ _onCellClick: function (event) { + if (this.mode === 'readonly' || !this.editable) { + return; + } var $td = $(event.currentTarget); var rowIndex = $td.parent().data('index'); var colIndex = $td.data('index'); @@ -492,13 +497,6 @@ ListRenderer.include({ this._selectCell(rowIndex, colIndex); event.stopPropagation(); } - // FIXME: this seems like dead code - // if (this.state.groupedBy.length) { - // var id = $td.parent().data('id'); - // if (id) { - // this.trigger_up('record_selected', {id:id}); - // } - // } }, /** * We need to manually unselect row, because noone else would do it diff --git a/addons/web/static/test/fields/relational_fields_tests.js b/addons/web/static/test/fields/relational_fields_tests.js index 3ea8ca06ad7..c76c5bdebe0 100644 --- a/addons/web/static/test/fields/relational_fields_tests.js +++ b/addons/web/static/test/fields/relational_fields_tests.js @@ -1025,7 +1025,7 @@ QUnit.module('relational_fields', { '"Add an item" should not visible in edit'); // edit existing subrecord - form.$('.o_list_view tbody tr:first()').click(); + form.$('.o_list_view tbody tr:first() td:eq(1)').click(); $('.modal .o_form_view .o_form_input').val('new name').trigger('input'); $('.modal .modal-footer .btn-primary').click(); // save