summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-05-20 22:15:48 +0200
committerGéry Debongnie <ged@odoo.com>2017-05-22 10:07:32 +0200
commit3adfa84cd60e289407c956661591b0d172e8012b (patch)
treeba2962dbd81b1a327039e033dd28b42482d9cb04 /addons/web/static/src/js/fields
parent28eadb3d6ee11bcee9bfe498387467c70953382a (diff)
[FIX] web: improve many2one edition with onchanges
When a many2one (in an editable list) with an onchange was edited, it could happen that a modal window asking for confirmation of the creation of a record was opened when it should not. Here is what actually could happen: * user focus a many2one * user type something * user press ENTER (keydown + keyup) * the onchange comes back * user press ENTER again * modal window is open Because of the onchange, the _reset method was called after the _onInputKeyup method. So, the m2o_value was not equal to the $input.val() and the 'floating' flag was set to true, which means that the _onInputFocusout method (called indirectly by the listeditablerenderer when unselecting the row) was forced to open a confirm dialog. We simply fix the problem by setting the floating flag back to false in the reset method.
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index e89fb563f21..fcc720b4ff7 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -256,6 +256,7 @@ var FieldMany2One = AbstractField.extend({
*/
_reset: function () {
this._super.apply(this, arguments);
+ this.floating = false;
this.m2o_value = field_utils.format.many2one(this.value);
},
/**