summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-04-30 18:09:03 +0200
committerGéry Debongnie <ged@odoo.com>2017-05-04 10:39:01 +0200
commite4532cfe51238c7763702aee4d8e615aba212462 (patch)
treeb4eb91d333cdd39ccc699739bcb8672626f60e04 /addons/web/static/src/js/fields
parent1314de50989901f9ea290b19676a6a6fa15496f8 (diff)
[FIX] web: various fixes in list view navigation
With this commit, we try to improve the way navigation is done in the list view. In particular, we want to make sure that pressing TAB on the last editable cell move the cursor to the next line (and create a new line if necessary). Also, we add a few tests for keyboard navigation (it was almost not tested before this commit, and while working on this commit, it was broken at some point).
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/abstract_field.js2
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js17
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js1
3 files changed, 18 insertions, 2 deletions
diff --git a/addons/web/static/src/js/fields/abstract_field.js b/addons/web/static/src/js/fields/abstract_field.js
index 9f977d41392..4948a3e3c31 100644
--- a/addons/web/static/src/js/fields/abstract_field.js
+++ b/addons/web/static/src/js/fields/abstract_field.js
@@ -344,7 +344,7 @@ var AbstractField = Widget.extend({
_setValue: function (value) {
// we try to avoid doing useless work, if the value given has not
// changed. Note that we compare the unparsed values.
- if (this.lastSetValue === value) {
+ if (this.lastSetValue === value || (this.value === false && value === '')) {
return;
}
this.lastSetValue = value;
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index a462efee6e0..e600954b967 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -56,6 +56,23 @@ var DebouncedField = AbstractField.extend({
},
//--------------------------------------------------------------------------
+ // Public
+ //--------------------------------------------------------------------------
+
+ /**
+ * Debounced fields do not notify the rest of the environment immediately of
+ * their new state, so it is necessary to actually get their value when this
+ * method is called.
+ *
+ * @override
+ */
+ commitChanges: function () {
+ if (this.mode === 'edit') {
+ this._setValue(this._getValue());
+ }
+ },
+
+ //--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index 2a3d5e01125..28d790b16c4 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -15,7 +15,6 @@ odoo.define('web.relational_fields', function (require) {
var AbstractField = require('web.AbstractField');
var concurrency = require('web.concurrency');
-var config = require('web.config');
var ControlPanel = require('web.ControlPanel');
var dialogs = require('web.view_dialogs');
var core = require('web.core');