[FIX] web: don't select cell in one2many (non editable)
The code for selectCell was active, when the user clicked on a td. No test caught that, because we simulated a click on a tr, not on a td. I guess that the lesson of the story is that our tests should be as close as possible to the real conditions, so we should simulate the click on the innermost element.
This commit is contained in:
committed by
Aaron Bohy
parent
fdd34465ac
commit
ed830f7394
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user