diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-05-20 22:51:52 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-05-22 10:07:32 +0200 |
| commit | 8436150ae5820f1bde403c912ab1f9945e327d99 (patch) | |
| tree | e04748acee6bc3288d1d58f7744c3a090e0177f7 /addons/web/static/src/js/fields/relational_fields.js | |
| parent | 3adfa84cd60e289407c956661591b0d172e8012b (diff) | |
[FIX] web: bad interaction between m2o, onchange and editable list
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)
* user press ENTER again
* the onchange comes back
* 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 (after the first ENTER).
The second ENTER caused a unselectRow in the editable list, so the input
was focusouted, and the modal is set. This is basically caused by the
asynchronous behaviour of the onchange.
We simply fix the problem by setting the floating flag back to false in
the keydown method.
Diffstat (limited to 'addons/web/static/src/js/fields/relational_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 8 |
1 files changed, 8 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 fcc720b4ff7..5dc74facf5e 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -470,6 +470,14 @@ var FieldMany2One = AbstractField.extend({ } }, /** + * @override + * @private + */ + _onKeydown: function () { + this.floating = false; + this._super.apply(this, arguments); + }, + /** * Stops the left/right navigation move event if the cursor is not at the * start/end of the input element. Stops any navigation move event if the * user is selecting text. |
