summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views
diff options
context:
space:
mode:
authorDavid Monjoie <dmo@odoo.com>2017-05-05 16:34:54 +0200
committerDavid Monjoie <dmo@odoo.com>2017-05-10 15:20:03 +0200
commite1edd62320fef4991ba9554ee197021b45987a60 (patch)
tree789c87279d7b49025560d38ef53c7939a2fe28cd /addons/web/static/src/js/views
parentec3baa60274b8271c74ab9f64cdb35a15105379f (diff)
[FIX] web: toggle checkboxes when clicked in editable list view
Previously, the checkbox was not checked when it was clicked in editable list view, it only opened the row but did not check the checkbox.
Diffstat (limited to 'addons/web/static/src/js/views')
-rw-r--r--addons/web/static/src/js/views/basic/basic_renderer.js2
-rw-r--r--addons/web/static/src/js/views/form/form_renderer.js2
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js25
3 files changed, 18 insertions, 11 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_renderer.js b/addons/web/static/src/js/views/basic/basic_renderer.js
index 5babc71ab6b..907ea7ddc07 100644
--- a/addons/web/static/src/js/views/basic/basic_renderer.js
+++ b/addons/web/static/src/js/views/basic/basic_renderer.js
@@ -164,7 +164,7 @@ var BasicRenderer = AbstractRenderer.extend({
var recordWidgets = this.allFieldWidgets[record.id] || [];
for (var i = 0 ; i < recordWidgets.length ; i++) {
- var activated = recordWidgets[currentIndex].activate();
+ var activated = recordWidgets[currentIndex].activate({event: options.event});
if (activated) {
return currentIndex;
}
diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js
index e9d84ce1f5f..e23525d8fda 100644
--- a/addons/web/static/src/js/views/form/form_renderer.js
+++ b/addons/web/static/src/js/views/form/form_renderer.js
@@ -717,7 +717,7 @@ var FormRenderer = BasicRenderer.extend({
}
});
if (focusWidget) {
- focusWidget.activate(true);
+ focusWidget.activate({noselect: true});
}
},
/**
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 65614e04983..49badb22f85 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
@@ -334,24 +334,31 @@ ListRenderer.include({
*
* @param {integer} rowIndex
* @param {integer} colIndex
- * @param {boolean} [wrap=true] if true and no widget could be selected from
- * the colIndex to the last column, then we wrap around and try to select
- * a widget starting from the beginning
+ * @param {Object} [options]
+ * @param {Event} [options.event] original target of the event which
+ * @param {boolean} [options.wrap=true] if true and no widget could be
+ * triggered the cell selection
+ * selected from the colIndex to the last column, then we wrap around and
+ * try to select a widget starting from the beginning
* @return {Deferred} fails if no cell could be selected
*/
- _selectCell: function (rowIndex, colIndex, wrap) {
+ _selectCell: function (rowIndex, colIndex, options) {
// Do nothing if the user tries to select current cell
if (rowIndex === this.currentRow && colIndex === this.currentCol) {
return $.when();
}
- wrap = wrap === undefined ? true : wrap;
+ var wrap = (!options || options.wrap === undefined) ? true : options.wrap;
// Select the row then activate the widget in the correct cell
var self = this;
return this._selectRow(rowIndex).then(function () {
var record = self.state.data[rowIndex];
var correctedIndex = colIndex - getNbButtonBefore(colIndex);
- var fieldIndex = self._activateFieldWidget(record, correctedIndex, {inc: 1, wrap: wrap});
+ var fieldIndex = self._activateFieldWidget(record, correctedIndex, {
+ inc: 1,
+ wrap: wrap,
+ event: options && options.event,
+ });
if (fieldIndex < 0) {
return $.Deferred().reject();
@@ -474,7 +481,7 @@ ListRenderer.include({
var $tr = $td.parent();
var rowIndex = this.$('.o_data_row').index($tr);
var colIndex = $tr.find('.o_data_cell').index($td);
- this._selectCell(rowIndex, colIndex);
+ this._selectCell(rowIndex, colIndex, {event: event});
},
/**
* We need to manually unselect row, because noone else would do it
@@ -536,7 +543,7 @@ ListRenderer.include({
break;
case 'previous':
if (this.currentCol > 0) {
- this._selectCell(this.currentRow, this.currentCol - 1, false)
+ this._selectCell(this.currentRow, this.currentCol - 1, {wrap: false})
.fail(this._moveToPreviousLine.bind(this));
} else {
this._moveToPreviousLine();
@@ -544,7 +551,7 @@ ListRenderer.include({
break;
case 'next':
if (this.currentCol + 1 < this.columns.length) {
- this._selectCell(this.currentRow, this.currentCol + 1, false)
+ this._selectCell(this.currentRow, this.currentCol + 1, {wrap: false})
.fail(this._moveToNextLine.bind(this));
} else {
this._moveToNextLine();