summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-02-26 09:53:33 +0100
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commited830f739491d01da92f2517bd4cee453d994923 (patch)
tree54e8fb41ab95ff757b9558773e31bb446db3902e /addons/web/static/src
parentfdd34465ac3518013903861c7f87d5fe2161e4e6 (diff)
[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.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js12
1 files changed, 5 insertions, 7 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 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