summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2019-05-06 07:23:40 +0000
committerAaron Bohy <aab@odoo.com>2019-07-09 12:15:03 +0000
commit3db2f7f73d2071aa51e3cd2182ef5e0ca38aabad (patch)
treecf5b54aff8291cad9a06aa084ca0c068e96e053f /addons/web/static/src
parent3eab0a54ffc571115ef8fef90e56206afdf6d33b (diff)
[FIX] web: tab navigation in editable list with only readonly fields
Let's assume an editable list with a row containing only readonly fields. Before this rev., if the user clicked on this row and then pressed TAB, it crashed. The crash occurred in historical code that now seems to be useless, so we simply removed it. closes odoo/odoo#34696 Signed-off-by: Julien Mougenot (JUM) <Arcasias@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js37
1 files changed, 5 insertions, 32 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 6469b78347a..3e60403fab2 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
@@ -1127,27 +1127,6 @@ ListRenderer.include({
}
},
/**
- * It will returns the last visible widget that is editable
- *
- * @private
- * @returns {Class} Widget returns last widget
- */
- _getLastWidget: function () {
- var recordID = this._getRecordID(this.currentRow);
- var recordWidgets = this.allFieldWidgets[recordID];
- var lastWidget = _.chain(recordWidgets).filter(function (widget) {
- var isLast =
- widget.$el.is(':visible') &&
- (
- widget.$('input').length > 0 || widget.tagName === 'input' ||
- widget.$('textarea').length > 0 || widget.tagName === 'textarea'
- ) &&
- !widget.$el.hasClass('o_readonly_modifier');
- return isLast;
- }).last().value();
- return lastWidget;
- },
- /**
* Handles the keyboard navigation according to events triggered by field
* widgets.
* - previous: move to the first activable cell on the left if any, if not
@@ -1175,18 +1154,12 @@ ListRenderer.include({
}
break;
case 'next':
- var column = this.columns[this.currentFieldIndex];
- var lastWidget = this._getLastWidget();
- if (column.attrs.name === lastWidget.name) {
- this._moveToNextLine();
+ if (this.currentFieldIndex + 1 < this.columns.length) {
+ this._selectCell(this.currentRow, this.currentFieldIndex + 1, {wrap: false})
+ .guardedCatch(this._moveToNextLine.bind(this));
} else {
- if (this.currentFieldIndex + 1 < this.columns.length) {
- this._selectCell(this.currentRow, this.currentFieldIndex + 1, {wrap: false})
- .guardedCatch(this._moveToNextLine.bind(this));
- } else {
- this._moveToNextLine();
- }
- }
+ this._moveToNextLine();
+ }
break;
case 'next_line':
this._moveToNextLine({forceCreate: true});